Qgrid 1.0 - An interactive grid for sorting, filtering, and editing pandas DataFrames in Jupyter Notebook
https://github.com/quantopian/qgrid#qgrid
/r/Python
https://redd.it/7p3g4t
https://github.com/quantopian/qgrid#qgrid
/r/Python
https://redd.it/7p3g4t
GitHub
GitHub - quantopian/qgrid: An interactive grid for sorting, filtering, and editing DataFrames in Jupyter notebooks
An interactive grid for sorting, filtering, and editing DataFrames in Jupyter notebooks - quantopian/qgrid
Ask Anything Monday - Weekly Thread
https://www.reddit.com/r/learnpython/comments/7oukzv/ask_anything_monday_weekly_thread/
/r/flask
https://redd.it/7p5k3l
https://www.reddit.com/r/learnpython/comments/7oukzv/ask_anything_monday_weekly_thread/
/r/flask
https://redd.it/7p5k3l
reddit
Ask Anything Monday - Weekly Thread • r/learnpython
Welcome to another /r/learnPython weekly "Ask Anything* Monday" thread Here you can ask all the questions that you wanted to ask but didn't feel...
Index page contains data only on first visit; refresh and subsequent visits are empty
Hello all and thanks for taking time to read into this issue I'm having.
I have a small web app that is passing an object to my index page, the index page loops and renders the object into a nice pretty table.
Here is my route:
@app.route('/', methods=['GET'])
def index():
return render_template('index.html', cursor=cursor, current_time=datetime.utcnow())
the "cursor" object is really a mongodb query that was created just above the route descriptor:
cursor = db.ipv4.find().sort([("prefix", 1), ("prefixLen", -1)])
This is ran through the index.html page's template, which looks like this:
{% for route in cursor %}
<tr>
<td>{{ route.prefix }}</td>
<td>{{ route.prefixLen }}</td>
<td>{{ route.aspath }}</td>
</tr>
{% endfor %}
The result is a beautiful table of my previous IPv4 unicast table, and it renders great, but only once! Any second visitor or a refresh to the page shows that there are no rows rendered for my table (looking at the page's source).
My theory is that there is something that I'm missing when passing the cursor variable into the view function, something that currently limits it to run just once. I am new to Flask so it is likely that I am mistaken and would greatly appreciate any pointers.
/r/flask
https://redd.it/7p1tma
Hello all and thanks for taking time to read into this issue I'm having.
I have a small web app that is passing an object to my index page, the index page loops and renders the object into a nice pretty table.
Here is my route:
@app.route('/', methods=['GET'])
def index():
return render_template('index.html', cursor=cursor, current_time=datetime.utcnow())
the "cursor" object is really a mongodb query that was created just above the route descriptor:
cursor = db.ipv4.find().sort([("prefix", 1), ("prefixLen", -1)])
This is ran through the index.html page's template, which looks like this:
{% for route in cursor %}
<tr>
<td>{{ route.prefix }}</td>
<td>{{ route.prefixLen }}</td>
<td>{{ route.aspath }}</td>
</tr>
{% endfor %}
The result is a beautiful table of my previous IPv4 unicast table, and it renders great, but only once! Any second visitor or a refresh to the page shows that there are no rows rendered for my table (looking at the page's source).
My theory is that there is something that I'm missing when passing the cursor variable into the view function, something that currently limits it to run just once. I am new to Flask so it is likely that I am mistaken and would greatly appreciate any pointers.
/r/flask
https://redd.it/7p1tma
reddit
Index page contains data only on first visit; refresh... • r/flask
Hello all and thanks for taking time to read into this issue I'm having. I have a small web app that is passing an object to my index page, the...
Index page contains data only on first visit; refresh and subsequent visits are empty
https://www.reddit.com/r/flask/comments/7p1tma/index_page_contains_data_only_on_first_visit/
/r/pystats
https://redd.it/7p4d6b
https://www.reddit.com/r/flask/comments/7p1tma/index_page_contains_data_only_on_first_visit/
/r/pystats
https://redd.it/7p4d6b
reddit
Index page contains data only on first visit; refresh... • r/flask
Hello all and thanks for taking time to read into this issue I'm having. I have a small web app that is passing an object to my index page, the...
A little library for making simple Electron-like HTML/JS GUI apps
https://github.com/ChrisKnott/Eel
/r/Python
https://redd.it/7p5x97
https://github.com/ChrisKnott/Eel
/r/Python
https://redd.it/7p5x97
GitHub
GitHub - python-eel/Eel: A little Python library for making simple Electron-like HTML/JS GUI apps
A little Python library for making simple Electron-like HTML/JS GUI apps - python-eel/Eel
A little library for making simple Electron-like HTML/JS GUI apps
https://github.com/ChrisKnott/Eel
/r/Python
https://redd.it/7p5x97
https://github.com/ChrisKnott/Eel
/r/Python
https://redd.it/7p5x97
GitHub
GitHub - python-eel/Eel: A little Python library for making simple Electron-like HTML/JS GUI apps
A little Python library for making simple Electron-like HTML/JS GUI apps - python-eel/Eel
How to improve your workflow with VS Code and Jupyter Notebook
https://medium.com/@_jithur/how-to-improve-your-workflow-with-vs-code-and-jupyter-notebook-f96777f8f1bd
/r/IPython
https://redd.it/7p8ej2
https://medium.com/@_jithur/how-to-improve-your-workflow-with-vs-code-and-jupyter-notebook-f96777f8f1bd
/r/IPython
https://redd.it/7p8ej2
Towards Data Science
How to improve your workflow with VS Code and Jupyter Notebook 💘
Supercharge your Data Science workflow. Jupyter Notebooks + VS Code = 💘
[P] A Tensorflow(v1.4) implementation of Capsule Networks
https://github.com/JunYeopLee/capsule-networks
/r/MachineLearning
https://redd.it/7p5y8z
https://github.com/JunYeopLee/capsule-networks
/r/MachineLearning
https://redd.it/7p5y8z
GitHub
JunYeopLee/capsule-networks
A Tensorflow(v1.4) implementation of Capsule Networks (Dynamic Routing Between Capsules , https://arxiv.org/abs/1710.09829) - JunYeopLee/capsule-networks
Running Flask in background (Without Celery)
I am attempting to do some automation work in the background of my Flask application. Basically I get a request and then want to run some boto3 automation infrastructure. Due to the nature of the tasks needing to be synchronous, the connection times out before it can give a response back. I want to simply run this in the background and celery is definitely overkill for this solution. I see that I can use APScheduler and can simply do a one time run based on time. I am wondering I can also do it via multiprocessing. So can I do something like:
@app.route(‘/create’, methods=[‘POST’]
def handle_create_request():
data = some_handler(request)
p=Process(target=create_aws_resources, args=(data,))
p.start()
return “Your resources are being provisioned”
This works locally in my dev, but when running in server implementation, the nature of a WSGI will cause it to be a blocking process. Can anyone give any guidance?
And I feel celery is completely overkill here is due to this process not being run that frequently. It ultimately takes just over a minute to execute and for the most part, it isn’t running that frequently. I know this could be transformed into a microservice down the line, but I am currently looking for a quick solution at the moment.
/r/flask
https://redd.it/7ozw84
I am attempting to do some automation work in the background of my Flask application. Basically I get a request and then want to run some boto3 automation infrastructure. Due to the nature of the tasks needing to be synchronous, the connection times out before it can give a response back. I want to simply run this in the background and celery is definitely overkill for this solution. I see that I can use APScheduler and can simply do a one time run based on time. I am wondering I can also do it via multiprocessing. So can I do something like:
@app.route(‘/create’, methods=[‘POST’]
def handle_create_request():
data = some_handler(request)
p=Process(target=create_aws_resources, args=(data,))
p.start()
return “Your resources are being provisioned”
This works locally in my dev, but when running in server implementation, the nature of a WSGI will cause it to be a blocking process. Can anyone give any guidance?
And I feel celery is completely overkill here is due to this process not being run that frequently. It ultimately takes just over a minute to execute and for the most part, it isn’t running that frequently. I know this could be transformed into a microservice down the line, but I am currently looking for a quick solution at the moment.
/r/flask
https://redd.it/7ozw84
reddit
Running Flask in background (Without Celery) • r/flask
I am attempting to do some automation work in the background of my Flask application. Basically I get a request and then want to run some boto3...
How to improve your workflow with VS Code and Jupyter Notebook
https://medium.com/@_jithur/how-to-improve-your-workflow-with-vs-code-and-jupyter-notebook-f96777f8f1bd
/r/JupyterNotebooks
https://redd.it/7p8bkm
https://medium.com/@_jithur/how-to-improve-your-workflow-with-vs-code-and-jupyter-notebook-f96777f8f1bd
/r/JupyterNotebooks
https://redd.it/7p8bkm
Towards Data Science
How to improve your workflow with VS Code and Jupyter Notebook 💘
Supercharge your Data Science workflow. Jupyter Notebooks + VS Code = 💘
How to access Google Drive files from a Jupyter server?
I'm working on a project that involves consolidating 100+ .csv files into one file and running specific queries on this data. However, all of these .csv files are located in Google Drive. I don't want to manually download all 100 .csv files and upload them to my Jupyter server, so I'm wondering if there is a way to access them easily and store them in a folder in the server.
I'm aware of the github code that allows you do to this, but my access was denied, so I'm hoping there's another way to do this.
/r/IPython
https://redd.it/7p85kj
I'm working on a project that involves consolidating 100+ .csv files into one file and running specific queries on this data. However, all of these .csv files are located in Google Drive. I don't want to manually download all 100 .csv files and upload them to my Jupyter server, so I'm wondering if there is a way to access them easily and store them in a folder in the server.
I'm aware of the github code that allows you do to this, but my access was denied, so I'm hoping there's another way to do this.
/r/IPython
https://redd.it/7p85kj
reddit
How to access Google Drive files from a Jupyter server? • r/IPython
I'm working on a project that involves consolidating 100+ .csv files into one file and running specific queries on this data. However, all of...
How to run ipython notebook and save straight to pdf w/o viewing?
I've been creating reports using ipython notebooks. When I want to present them to others I print to pdf and then share. Is it possible to run all the cells in a notebook and save the resulting notebook to pdf w/o opening the notebook?
/r/IPython
https://redd.it/7p9ci4
I've been creating reports using ipython notebooks. When I want to present them to others I print to pdf and then share. Is it possible to run all the cells in a notebook and save the resulting notebook to pdf w/o opening the notebook?
/r/IPython
https://redd.it/7p9ci4
reddit
How to run ipython notebook and save straight to pdf... • r/IPython
I've been creating reports using ipython notebooks. When I want to present them to others I print to pdf and then share. Is it possible to run all...
What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/7p7b6z
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/7p7b6z
reddit
What's everyone working on this week? • r/Python
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your...
Collaborating on a project.
Hello! I'm looking to create a project and I wanted to see if anyone else is interested in joining. I've gone through a couple books so I'd consider myself a step above beginner in terms of ability and this project wouldn't be anything serious, just an exercise to get better at Django.
/r/djangolearning
https://redd.it/7pd3k2
Hello! I'm looking to create a project and I wanted to see if anyone else is interested in joining. I've gone through a couple books so I'd consider myself a step above beginner in terms of ability and this project wouldn't be anything serious, just an exercise to get better at Django.
/r/djangolearning
https://redd.it/7pd3k2
reddit
Collaborating on a project. • r/djangolearning
Hello! I'm looking to create a project and I wanted to see if anyone else is interested in joining. I've gone through a couple books so I'd...
Python Open Source Projects of the Year
https://medium.com/@Mybridge/30-amazing-python-projects-for-the-past-year-v-2018-9c310b04cdb3
/r/Python
https://redd.it/7pbe9z
https://medium.com/@Mybridge/30-amazing-python-projects-for-the-past-year-v-2018-9c310b04cdb3
/r/Python
https://redd.it/7pbe9z
Medium
30 Amazing Python Projects for the Past Year (v.2018)
For the past year, we’ve compared nearly 15,000 open source Python projects to pick Top 30 (0.2% chance).
[AF] POST request on one of multiple defined endpoints returns 404
EDIT: The error ended up being with NGINX, all I needed to do was change the ownership of the /var/lib/nginx directory from the nginx user to the user running the Flask application. Doh
Hi, I was having the darndest time debugging this and couldn't find anything similar online so hopefully you guys can help me get to the bottom of this
I have two endpoints, a login and a post submitter. Both are GET and POST request endpoints, both are defined, both work locally. Deployed, however, the login endpoint works fine but POST requests on the post submitter endpoint always return a 404. I don't believe it's an issue with NGINX or gunicorn as the logs show nothing out of the ordinary and the login endpoint works flawlessly. I've spent almost two days debugging this and I just can't for the life of me figure it out. Relevant code snippets are posted below.
@app.route('/newpost', methods=['GET', 'POST'])
@login_required
def new_post():
form = BlogForm()
#No code in this conditional is ever actually executed, 404's first
if form.validate_on_submit():
#Omitted code for getting form data and creating form object
try:
#Omitted code for database actions
return redirect(url_for('index', _external=True))
except IntegrityError:
flash("Error inserting into database")
return('', 203)
else:
#Omitted some code for template rendering
return render_template('new_post.html')
@app.route('/login', methods=['GET', 'POST'])
def login():
form = LoginForm()
userAuth = current_user.is_authenticated
if form.validate_on_submit():
flash("Login attempt logged")
user = User.query.filter_by(username=form.userID.data).first()
if user:
checkPass = form.password.data.encode('utf-8')
if bcrypt.checkpw(checkPass, user.password):
user.authenticated = True
login_user(user, remember=form.remember_me.data)
return redirect(url_for('index', _external=True))
else:
form.errors['password'] = 'false'
else:
form.errors['username'] = 'false'
else:
return render_template('login.html',
title='Log In',
loggedIn=userAuth,
form=form)
/r/flask
https://redd.it/7p1g11
EDIT: The error ended up being with NGINX, all I needed to do was change the ownership of the /var/lib/nginx directory from the nginx user to the user running the Flask application. Doh
Hi, I was having the darndest time debugging this and couldn't find anything similar online so hopefully you guys can help me get to the bottom of this
I have two endpoints, a login and a post submitter. Both are GET and POST request endpoints, both are defined, both work locally. Deployed, however, the login endpoint works fine but POST requests on the post submitter endpoint always return a 404. I don't believe it's an issue with NGINX or gunicorn as the logs show nothing out of the ordinary and the login endpoint works flawlessly. I've spent almost two days debugging this and I just can't for the life of me figure it out. Relevant code snippets are posted below.
@app.route('/newpost', methods=['GET', 'POST'])
@login_required
def new_post():
form = BlogForm()
#No code in this conditional is ever actually executed, 404's first
if form.validate_on_submit():
#Omitted code for getting form data and creating form object
try:
#Omitted code for database actions
return redirect(url_for('index', _external=True))
except IntegrityError:
flash("Error inserting into database")
return('', 203)
else:
#Omitted some code for template rendering
return render_template('new_post.html')
@app.route('/login', methods=['GET', 'POST'])
def login():
form = LoginForm()
userAuth = current_user.is_authenticated
if form.validate_on_submit():
flash("Login attempt logged")
user = User.query.filter_by(username=form.userID.data).first()
if user:
checkPass = form.password.data.encode('utf-8')
if bcrypt.checkpw(checkPass, user.password):
user.authenticated = True
login_user(user, remember=form.remember_me.data)
return redirect(url_for('index', _external=True))
else:
form.errors['password'] = 'false'
else:
form.errors['username'] = 'false'
else:
return render_template('login.html',
title='Log In',
loggedIn=userAuth,
form=form)
/r/flask
https://redd.it/7p1g11
reddit
[AF] POST request on one of multiple defined endpoints... • r/flask
EDIT: The error ended up being with NGINX, all I needed to do was change the ownership of the /var/lib/nginx directory from the nginx user to the...
Python script as Windows service only working in DEBUG mode
Hi r/python, I'm trying to run a dummy Python script as a service in Windows 7. It just writes the current time to a file in disk. My code goes like this:
import os
import time
import win32serviceutil
import win32service
import win32event
import servicemanager
import socket
class AppServerSvc (win32serviceutil.ServiceFramework):
_svc_name_ = "DummyService"
_svc_display_name_ = "Dummy App"
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
socket.setdefaulttimeout(60)
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
win32event.SetEvent(self.hWaitStop)
def SvcDoRun(self):
self.ReportServiceStatus(win32service.SERVICE_START_PENDING)
self.ReportServiceStatus(win32service.SERVICE_RUNNING)
servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_, ''))
self._logger.info("Service Is Starting")
dummy()
def dummy():
while True:
dummy_file = open('C:\dummy_text.txt', 'w+')
trace = str(time.time()) + '\n'
dummy_file.write(trace)
dummy_file.close()
time.sleep(40)
if __name__ == '__main__':
win32serviceutil.HandleCommandLine(AppServerSvc)
When I go to the directory containing the script and run *python dummyproc.py install* it tells me *Service installed*. I can debug the process with *python dummyproc.py debug* and it works fine (writes the file). But if I run *python dummyproc.py start* it gives me an error (it tells me that the service timed out against the start or control request). If I go to Windows 7 services and try to run it manually it also tells me the error code: 1053. I've been googling so far and tried many solutions but none of them worked for me. I included python and their Scripts and DLLs folders to the system path, I incremented the ServicesPipeTimeout value on regedit, I tried to install it as my user, tried to run not as a python script but as an executable compiled with pyinstaller... It did not work. Does anybody know what could be happening?? I'm using Windows 7 Professional 64 bits and Python 2.7.13.
Thank you in advanced!
/r/Python
https://redd.it/7pedd5
Hi r/python, I'm trying to run a dummy Python script as a service in Windows 7. It just writes the current time to a file in disk. My code goes like this:
import os
import time
import win32serviceutil
import win32service
import win32event
import servicemanager
import socket
class AppServerSvc (win32serviceutil.ServiceFramework):
_svc_name_ = "DummyService"
_svc_display_name_ = "Dummy App"
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
socket.setdefaulttimeout(60)
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
win32event.SetEvent(self.hWaitStop)
def SvcDoRun(self):
self.ReportServiceStatus(win32service.SERVICE_START_PENDING)
self.ReportServiceStatus(win32service.SERVICE_RUNNING)
servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_, ''))
self._logger.info("Service Is Starting")
dummy()
def dummy():
while True:
dummy_file = open('C:\dummy_text.txt', 'w+')
trace = str(time.time()) + '\n'
dummy_file.write(trace)
dummy_file.close()
time.sleep(40)
if __name__ == '__main__':
win32serviceutil.HandleCommandLine(AppServerSvc)
When I go to the directory containing the script and run *python dummyproc.py install* it tells me *Service installed*. I can debug the process with *python dummyproc.py debug* and it works fine (writes the file). But if I run *python dummyproc.py start* it gives me an error (it tells me that the service timed out against the start or control request). If I go to Windows 7 services and try to run it manually it also tells me the error code: 1053. I've been googling so far and tried many solutions but none of them worked for me. I included python and their Scripts and DLLs folders to the system path, I incremented the ServicesPipeTimeout value on regedit, I tried to install it as my user, tried to run not as a python script but as an executable compiled with pyinstaller... It did not work. Does anybody know what could be happening?? I'm using Windows 7 Professional 64 bits and Python 2.7.13.
Thank you in advanced!
/r/Python
https://redd.it/7pedd5
reddit
Python script as Windows service only working in DEBUG mode • r/Python
Hi r/python, I'm trying to run a dummy Python script as a service in Windows 7. It just writes the current time to a file in disk. My code goes...