Tuesday Daily Thread: Advanced questions
Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.
If your question is a beginner question we hold a beginner Daily Thread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.
This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.
/r/Python
https://redd.it/xuzlry
Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.
If your question is a beginner question we hold a beginner Daily Thread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.
This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.
/r/Python
https://redd.it/xuzlry
Discord
Join the Python Discord Server!
We're a large community focused around the Python programming language. We believe that anyone can learn to code. | 412982 members
Collaborative Jupyter Whiteboards
I found a common occurrence in data science type of meetings is someone screen-shares their Jupyter notebook either by Zoom, Hangouts, or conference room display and then starts scrolling through it explaining their tables, plots, markdown, Latex, etc. When I want to ask a question about a plot that the presenter scrolled past, there's a lot of "can you scroll up a little, no too far, back down a little". If I want to point to an area of a plot or column in a table, I can do it in Zoom, but it's all out of place once the notebook is scrolled. Usually someone has to ask the presenter to zoom in to see some tiny Matplotlib font.
This led me to start looking into multiplayer versions of Jupyter that strive to be like Google Docs. There's proprietary ones like CoCalc and DeepNote, then there's open-source work underway to add real time collaboration to JupyterLab using Yjs. All of these are geared towards collaborative editing of the notebook code, but I really needed and saw a use for was collaborative viewing of the results contained in the notebook. Since notebooks usually have access to lots of valuable data, IT can
/r/JupyterNotebooks
https://redd.it/xvjtjd
I found a common occurrence in data science type of meetings is someone screen-shares their Jupyter notebook either by Zoom, Hangouts, or conference room display and then starts scrolling through it explaining their tables, plots, markdown, Latex, etc. When I want to ask a question about a plot that the presenter scrolled past, there's a lot of "can you scroll up a little, no too far, back down a little". If I want to point to an area of a plot or column in a table, I can do it in Zoom, but it's all out of place once the notebook is scrolled. Usually someone has to ask the presenter to zoom in to see some tiny Matplotlib font.
This led me to start looking into multiplayer versions of Jupyter that strive to be like Google Docs. There's proprietary ones like CoCalc and DeepNote, then there's open-source work underway to add real time collaboration to JupyterLab using Yjs. All of these are geared towards collaborative editing of the notebook code, but I really needed and saw a use for was collaborative viewing of the results contained in the notebook. Since notebooks usually have access to lots of valuable data, IT can
/r/JupyterNotebooks
https://redd.it/xvjtjd
reddit
Collaborative Jupyter Whiteboards
I found a common occurrence in data science type of meetings is someone screen-shares their Jupyter notebook either by Zoom, Hangouts, or...
Your all-time favorite Django youtube tutorial?
Looking for some suggestions!
/r/django
https://redd.it/xvd7fv
Looking for some suggestions!
/r/django
https://redd.it/xvd7fv
reddit
Your all-time favorite Django youtube tutorial?
Looking for some suggestions!
Can pylint be used for jupyter notebook projects?
Can pylint be used for jupyter notebook projects? If not is there another lint that gets the job done?
Appreciate the answers
/r/JupyterNotebooks
https://redd.it/xtzch6
Can pylint be used for jupyter notebook projects? If not is there another lint that gets the job done?
Appreciate the answers
/r/JupyterNotebooks
https://redd.it/xtzch6
reddit
Can pylint be used for jupyter notebook projects?
Can pylint be used for jupyter notebook projects? If not is there another lint that gets the job done? Appreciate the answers
Wednesday Daily Thread: Beginner questions
New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!
This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.
/r/Python
https://redd.it/xvut41
New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!
This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.
/r/Python
https://redd.it/xvut41
Discord
Join the Python Discord Server!
We're a large community focused around the Python programming language. We believe that anyone can learn to code. | 412982 members
%%time only displays wall time
Hello everyone I am having trouble measuring the CPU time taken by a function but the problem is as the title says. The cell magic command %%time only displays the wall time and does not display the CPU time.
Any suggestion would be really helpful.
Thank you.
/r/JupyterNotebooks
https://redd.it/xtdnhc
Hello everyone I am having trouble measuring the CPU time taken by a function but the problem is as the title says. The cell magic command %%time only displays the wall time and does not display the CPU time.
Any suggestion would be really helpful.
Thank you.
/r/JupyterNotebooks
https://redd.it/xtdnhc
reddit
%%time only displays wall time
Hello everyone I am having trouble measuring the CPU time taken by a function but the problem is as the title says. The cell magic command %%time...
Flask & Stripe Mini eCommerce - MIT / BS5 Design / No database / Products Saved in JSON files / VIDEO presentation in comments
https://github.com/app-generator/sample-flask-stripe
/r/flask
https://redd.it/xw5rek
https://github.com/app-generator/sample-flask-stripe
/r/flask
https://redd.it/xw5rek
GitHub
GitHub - app-generator/sample-flask-stripe: Flask Stripe Sample - Soft UI Design (Free Sample) | AppSeed
Flask Stripe Sample - Soft UI Design (Free Sample) | AppSeed - GitHub - app-generator/sample-flask-stripe: Flask Stripe Sample - Soft UI Design (Free Sample) | AppSeed
Generate image in pdf via pdfjinjax
Hi so I am using this library https://github.com/edgaraafelix/pdfjinjax pdfjinjax a fork from pdfjinja I believe both examples were already in pdf format and upon checking both sample.json and example.py the field signature was just a file path and it was already instantiated the image once the pdf created.
But I had a pdf from scracth and I do not know what field in LibreOffice to use for that effect. I tried Image control, Image button but image was not created. In textfield it just paste the file path and not rendering.
In django use, I need to send a file back to the user with premade pdf :) and it needs the image for the header.
So any experienced user used that library how to achieve that? Thank you.
/r/djangolearning
https://redd.it/xwak6u
Hi so I am using this library https://github.com/edgaraafelix/pdfjinjax pdfjinjax a fork from pdfjinja I believe both examples were already in pdf format and upon checking both sample.json and example.py the field signature was just a file path and it was already instantiated the image once the pdf created.
But I had a pdf from scracth and I do not know what field in LibreOffice to use for that effect. I tried Image control, Image button but image was not created. In textfield it just paste the file path and not rendering.
In django use, I need to send a file back to the user with premade pdf :) and it needs the image for the header.
So any experienced user used that library how to achieve that? Thank you.
/r/djangolearning
https://redd.it/xwak6u
GitHub
GitHub - edgaraafelix/pdfjinjax
Contribute to edgaraafelix/pdfjinjax development by creating an account on GitHub.
Update and delete database records with AJAX
so currently i'm using javascipt and ajax to delete and update records of my database but I've seen tutorials creating routes for these actions and linking the button to that route while passing the id as a parameter.
My question is is my way of doing things worse than the route method? Should I adapt the route method instead? if yes why if no why?
it's either:python
@app.route("/example", methods="GET","POST")
def example():
if request.method="GET":
return rendertemplate("example.html")
if request.method="POST":
req= request.getjson()
id = req"request"
logic for deleting from database
javascript
let mybtn = document.getElementById("mybtn")
mybtn.addEventListener("click", ()=>{
fetch(window.origin+"/example",{
method:"POST",
headers: new Headers({
"X-CSRFToken": document.getElementsByName("csrftoken")0.value,
/r/flask
https://redd.it/xwe3ob
so currently i'm using javascipt and ajax to delete and update records of my database but I've seen tutorials creating routes for these actions and linking the button to that route while passing the id as a parameter.
My question is is my way of doing things worse than the route method? Should I adapt the route method instead? if yes why if no why?
it's either:python
@app.route("/example", methods="GET","POST")
def example():
if request.method="GET":
return rendertemplate("example.html")
if request.method="POST":
req= request.getjson()
id = req"request"
logic for deleting from database
javascript
let mybtn = document.getElementById("mybtn")
mybtn.addEventListener("click", ()=>{
fetch(window.origin+"/example",{
method:"POST",
headers: new Headers({
"X-CSRFToken": document.getElementsByName("csrftoken")0.value,
/r/flask
https://redd.it/xwe3ob
reddit
Update and delete database records with AJAX
so currently i'm using javascipt and ajax to delete and update records of my database but I've seen tutorials creating routes for these actions...
Reasoning about asyncio.Semaphore (article by Guido van Rossum)
https://neopythonic.blogspot.com/2022/10/reasoning-about-asynciosemaphore.html
/r/Python
https://redd.it/xw4f0k
https://neopythonic.blogspot.com/2022/10/reasoning-about-asynciosemaphore.html
/r/Python
https://redd.it/xw4f0k
Blogspot
Reasoning about asyncio.Semaphore
In Silicon Valley is a very exclusive fast-food restaurant, which is always open. There is one table, where one guest at a time is served a...
Loop through colummyear (not time series)?
I have a huge data set that will only run every paragraph when one year is filtered at a time. i.e. the publication year of a book.
Right now, I have to manually change the year filter each time I want updated data.
Is there a way to create a loop using a specific column (publicationyear)?
I know I can use airflow to autmoate this, but I'm too unfamiliar with it. Tried finding an answer on stackflow & google but can't seem to find what I need.
/r/JupyterNotebooks
https://redd.it/xwjlwx
I have a huge data set that will only run every paragraph when one year is filtered at a time. i.e. the publication year of a book.
Right now, I have to manually change the year filter each time I want updated data.
Is there a way to create a loop using a specific column (publicationyear)?
I know I can use airflow to autmoate this, but I'm too unfamiliar with it. Tried finding an answer on stackflow & google but can't seem to find what I need.
/r/JupyterNotebooks
https://redd.it/xwjlwx
reddit
Loop through columm_year (not time series)?
I have a huge data set that will only run every paragraph when one year is filtered at a time. i.e. the publication year of a book. Right now, I...
how to use flask with existing database
I am really quite confused about working with databases that already exist. I have followed a bunch of tutorials and read Miguel Grinberg's book, so I am familiar with the basics of how to use flask-sqlalchemy. However I have very limited database experience outside of this (aside from writing a few basic SQL commands), and the SQLAlchemy documentation completely defeats me.
Surely this is a common scenario (already have database, decide to create flask app to access it and so on), but I have never seen a tutorial anywhere that actually explains ways to handle this and now I am stuck. I do not really mind if it is with flask-sqlalchemy or with standard sqlalchemy, as long as I can do something robust.
Flask-sqlalchemy makes it reeeeally convenient to connect the app and query/insert into the table. As I understand it, this requires a set of table classes e.g. a `User` class in a `models.py` file. I know there are things like automap/reflect in the SQLAlchemy API, but I have not been able to really understand those docs sufficiently to know if I can use it with flask, and without any frame of reference it is hard to know if this is
/r/flask
https://redd.it/xwhvic
I am really quite confused about working with databases that already exist. I have followed a bunch of tutorials and read Miguel Grinberg's book, so I am familiar with the basics of how to use flask-sqlalchemy. However I have very limited database experience outside of this (aside from writing a few basic SQL commands), and the SQLAlchemy documentation completely defeats me.
Surely this is a common scenario (already have database, decide to create flask app to access it and so on), but I have never seen a tutorial anywhere that actually explains ways to handle this and now I am stuck. I do not really mind if it is with flask-sqlalchemy or with standard sqlalchemy, as long as I can do something robust.
Flask-sqlalchemy makes it reeeeally convenient to connect the app and query/insert into the table. As I understand it, this requires a set of table classes e.g. a `User` class in a `models.py` file. I know there are things like automap/reflect in the SQLAlchemy API, but I have not been able to really understand those docs sufficiently to know if I can use it with flask, and without any frame of reference it is hard to know if this is
/r/flask
https://redd.it/xwhvic
reddit
how to use flask with existing database
I am really quite confused about working with databases that already exist. I have followed a bunch of tutorials and read Miguel Grinberg's book,...
Introducing telekinesis.cloud - Upload code to the cloud directly from your Jupyter notebook
https://www.youtube.com/watch?v=FRndQVJSZcs&t
/r/JupyterNotebooks
https://redd.it/wwmiw5
https://www.youtube.com/watch?v=FRndQVJSZcs&t
/r/JupyterNotebooks
https://redd.it/wwmiw5
YouTube
Introducing telekinesis.cloud - How to upload code to the cloud directly from your Jupyter notebook
Telekinesis.cloud is a new way of uploading code to the cloud.
Whether you want to develop the backend for a webapp or you want to scale your resources, telekinesis.cloud lets you put the code you already have in the cloud, with minimum effort. Just log…
Whether you want to develop the backend for a webapp or you want to scale your resources, telekinesis.cloud lets you put the code you already have in the cloud, with minimum effort. Just log…
Tried to deploy my project on the internet - getting this error. What am I doing wrong?
/r/django
https://redd.it/xw42bn
/r/django
https://redd.it/xw42bn
400 Bad request error
This is the error I keep on getting: werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. KeyError: 'all\_chat'
And heres my code:
[app.py](https://app.py):
* Put @ app in single quotes so it won't change to a link
'@app'.route('/room', methods=\['GET', 'POST'\])
def room():
if(request.form\["all\_chat"\]):
return render\_template('chat\_all.html', session=session)
else:
return render\_template('join\_room.html', session=session)
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chat</title>
<link href="../static/style.css" rel="stylesheet">
<link href="../static/bootstrap.min.css" rel="stylesheet">
</head>
<body class="text-center">
<form class="form-signin" action="/room" method="post">
<h1 class="mb-3 font-weight-normal">Click One of the Buttons Below</h1>
<button name="all\_chat" class="btn btn-lg btn-primary btn-block" value="submit">Join All Chat</button>
<button name="chatting\_room" class="btn btn-lg btn-primary btn-block" value="submit">Join a Room</button>
</form>
</body>
</html>
/r/flask
https://redd.it/xwtgd5
This is the error I keep on getting: werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. KeyError: 'all\_chat'
And heres my code:
[app.py](https://app.py):
* Put @ app in single quotes so it won't change to a link
'@app'.route('/room', methods=\['GET', 'POST'\])
def room():
if(request.form\["all\_chat"\]):
return render\_template('chat\_all.html', session=session)
else:
return render\_template('join\_room.html', session=session)
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chat</title>
<link href="../static/style.css" rel="stylesheet">
<link href="../static/bootstrap.min.css" rel="stylesheet">
</head>
<body class="text-center">
<form class="form-signin" action="/room" method="post">
<h1 class="mb-3 font-weight-normal">Click One of the Buttons Below</h1>
<button name="all\_chat" class="btn btn-lg btn-primary btn-block" value="submit">Join All Chat</button>
<button name="chatting\_room" class="btn btn-lg btn-primary btn-block" value="submit">Join a Room</button>
</form>
</body>
</html>
/r/flask
https://redd.it/xwtgd5
Django Docker Containers and good example projects
I am building a project that I want to deploy on a could service that requires me having a Docker image of my project.
I am new to the concept of handling multiple container at a single project ex.: Apache Airflow base Image. (I am more used to just runing a single jupyter lab in a single container)
Are there any example codes, practical docker Django guides that you would recommend so I can pick up the skill how to add nginex and js libraries to the project, etc. that I don't even think that is important now but it would help me a lot to pick up on the basic and intermediate lvl of docker with Django ?
/r/django
https://redd.it/xw7nyy
I am building a project that I want to deploy on a could service that requires me having a Docker image of my project.
I am new to the concept of handling multiple container at a single project ex.: Apache Airflow base Image. (I am more used to just runing a single jupyter lab in a single container)
Are there any example codes, practical docker Django guides that you would recommend so I can pick up the skill how to add nginex and js libraries to the project, etc. that I don't even think that is important now but it would help me a lot to pick up on the basic and intermediate lvl of docker with Django ?
/r/django
https://redd.it/xw7nyy
reddit
Django Docker Containers and good example projects
I am building a project that I want to deploy on a could service that requires me having a Docker image of my project. I am new to the concept of...
Easiest way to run Jupyter Notebooks?
I'm working on a project to develop interactive plots on jupyter notebook and would like to share them with students in the easiest way for them to run the notebooks.
I've seen lots of webs and servers that allow code to be run without installation/account creation if the proper setup is made, but I need it to be a free service (I don't really care if their PC has to run the code, but I think they'll need to install jupyter notebook then).
I'd like to know your opinion about which would be the best web/program in this situation, as I don't have much experience on this topic and there are lots of different webs that offer running jupyter notebooks as a service.
If you need a more clear statement of my preferences, they would be:
\- Needs to be free.
\- Needs to run the code (interactive figure animations).
\- Avoid as much Installation/Account creation as possible for the viewer.
/r/JupyterNotebooks
https://redd.it/wmj9vm
I'm working on a project to develop interactive plots on jupyter notebook and would like to share them with students in the easiest way for them to run the notebooks.
I've seen lots of webs and servers that allow code to be run without installation/account creation if the proper setup is made, but I need it to be a free service (I don't really care if their PC has to run the code, but I think they'll need to install jupyter notebook then).
I'd like to know your opinion about which would be the best web/program in this situation, as I don't have much experience on this topic and there are lots of different webs that offer running jupyter notebooks as a service.
If you need a more clear statement of my preferences, they would be:
\- Needs to be free.
\- Needs to run the code (interactive figure animations).
\- Avoid as much Installation/Account creation as possible for the viewer.
/r/JupyterNotebooks
https://redd.it/wmj9vm
reddit
Easiest way to run Jupyter Notebooks?
I'm working on a project to develop interactive plots on jupyter notebook and would like to share them with students in the easiest way for them...
Jupyter Lab vs Jupyter Notebook
I currently mainly use Jupyter Notebooks because I know all the shortcut keys (a and b) to open a cell above or below and (c,v) to cut and paste simply. I like the idea of moving to JupyterLab but I miss my shortcut keys. Is there a solution for JupyterLab so that I can still use my keyboard without having to go back to using a mouse all the time?
/r/JupyterNotebooks
https://redd.it/wmcq81
I currently mainly use Jupyter Notebooks because I know all the shortcut keys (a and b) to open a cell above or below and (c,v) to cut and paste simply. I like the idea of moving to JupyterLab but I miss my shortcut keys. Is there a solution for JupyterLab so that I can still use my keyboard without having to go back to using a mouse all the time?
/r/JupyterNotebooks
https://redd.it/wmcq81
reddit
Jupyter Lab vs Jupyter Notebook
I currently mainly use Jupyter Notebooks because I know all the shortcut keys (a and b) to open a cell above or below and (c,v) to cut and paste...
Any long-run risk with sqlite?
So I'm using sqlite for the database for a record taking web app with flask. Basically, the web app takes records of people who walk into the office and such. It's all a glorified spreadsheet. Heard somewhere sqlite is limited. Wanted to know in what capacity that is.
/r/flask
https://redd.it/xx0c1s
So I'm using sqlite for the database for a record taking web app with flask. Basically, the web app takes records of people who walk into the office and such. It's all a glorified spreadsheet. Heard somewhere sqlite is limited. Wanted to know in what capacity that is.
/r/flask
https://redd.it/xx0c1s
reddit
Any long-run risk with sqlite?
So I'm using sqlite for the database for a record taking web app with flask. Basically, the web app takes records of people who walk into the...
'jupyter notebook' command doesn't work...
I'm trying to read some documentation for a course, and that's entirely in Jupyter Notebook. There's this documentation here and the very course that tell me I should just type
PS W:\> jupyter notebook
usage: jupyter -h --version --config-dir --data-dir --runtime-dir --paths --json --debug subcommand
Jupyter: Interactive Computing
positional arguments:
subcommand the subcommand to launch
options:
-h, --help show this help message and exit
--version show the versions of core jupyter packages and exit
--config-dir show Jupyter config dir
--data-dir show Jupyter data dir
--runtime-dir show Jupyter runtime dir
--paths show all Jupyter paths. Add --json for machine-readable
/r/JupyterNotebooks
https://redd.it/wm1lzw
I'm trying to read some documentation for a course, and that's entirely in Jupyter Notebook. There's this documentation here and the very course that tell me I should just type
jupyter notebook and it should run, but what I get instead is this:PS W:\> jupyter notebook
usage: jupyter -h --version --config-dir --data-dir --runtime-dir --paths --json --debug subcommand
Jupyter: Interactive Computing
positional arguments:
subcommand the subcommand to launch
options:
-h, --help show this help message and exit
--version show the versions of core jupyter packages and exit
--config-dir show Jupyter config dir
--data-dir show Jupyter data dir
--runtime-dir show Jupyter runtime dir
--paths show all Jupyter paths. Add --json for machine-readable
/r/JupyterNotebooks
https://redd.it/wm1lzw