Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
R processes left over after nbconvert

I have a notebook running some R code every night on a server using nbconvert. For some reason when the job is done there's still an R process running in the background. I end up just killing them all every other week or so after they've piled up.

Has anyone else experienced this before? Is there a way to make sure that these are ended when the nbconvert finishes?

/r/JupyterNotebooks
https://redd.it/ber4rb
Jupyter Notebook dot notation dropdown menu arrowkeys problem

Hi guys,

I didn’t know where else to turn, I couldn’t find anything online about this small problem I’m having with jupyter notebook.

When I tab and open the dropdown menu to see the options for the dot notation I can’t scroll through the options with my arrow keys like I see in vids. I can’t do this on my computer, but on my laptop I don’t have this issue. Is it some option I accidentally turned off or something? Thanks.

/r/JupyterNotebooks
https://redd.it/benrfl
Having some trouble with my production server and NGINX with Google Search Console

Hey /r/Django,

​

I have recently put my Django site on production and configured it with NGINX so that it redirects from port 80 to port 8000, so that the URL doens't have to contain the port number when accessing it. I recently was trying to set up the google search console to index my website, and the crawl worked perfectly fine when I put in the URL with port 8000 \[[http://example.com:8000/\]](http://website.com:8000/]), however I get a: `This page is not in the index, but not because of an error. See the details below to learn why it wasn't indexed. Learn More` error when I try to crawl the website default [http://](http://website.com/)[example](http://website.com:8000/])[.com/](http://website.com/). So in essence it isn't crawling when I use the url without the 8000 port even though I can access my site perfectly fine without the port 8000 now.

​

I have spent quite some time researching on this specific issue however I think there is something that I am missing that I might not know about and hope that somebody can point me in the right direction. This is very new to me, I can post relevant information if needed however I would appreciate any guidance in further assisting me with this

/r/django
https://redd.it/beub5v
Why Use Anaconda?

Hi, I'm pretty new to python and I was wondering why do you use Anaconda and should I use it, and also what are some downsides of it

/r/Python
https://redd.it/betkoj
reqparse parser.add_argument()

Hi everyone,

​

I am not sure I understand how to user parser correctly. My confusion is: when adding arguments to the parser, say:

parser.add_argument('username', help = 'This field cannot be blank', required = True)

how does flask know to only look for the required argument in a specific route (in this case /login) ?

I haven't really tested it, but if I have multiple required arguments for different routes, I wonder if the application knows which ones are required for that route.

I would appreciate some help understanding this :) Thank you and happy holiday!

/r/flask
https://redd.it/beywgw
Testing without tests

I have seen many developers (mostly amateurs and intermediates) write code without tests. When asked about it, they say that they test their code locally, and therefore, dont feel the need to write tests separately.

Is this approach okay? Is TDD really important, or can you get away with simply testing code without writing tests?

/r/Python
https://redd.it/bezsyu
Flask, Vuejs, Celery, and MongoEngine project I've been working on

Though I would share my project I'm working on so others can use it as a template. Took me hours to get a module backend that worked well with Celery, Flask, MongoDB and Sockets.

Technologies:

* Flask
* Flask-Scoketio
* Flask-RESTful
* Flask-Login
* Eventlet
* Gunicorn
* Vuejs
* Celery
* MongoEngine
* Docker

​

[Link](https://github.com/jsbroks/coco-annotator)

/r/flask
https://redd.it/bf1212
Flask textbox fields?

Still very new to flask, so I'm sure there are probably some things that I could have done better/ didn't know you could do. Let me know if there's anything I should do for better practice.

​

I have a program that will take in a bunch of textbox inputs. After clicking a button, I want the result to be displayed. As of right now, the only thing I could really think of was:

form.result.label.text = result

However, that only changes the text box's label. Is there anyways I can have the result be posted into the textbox field? Or is there a label attribute I can use like a gui label? Thanks

#form.py
from flask_wtf import FlaskForm
from wtforms import StringField, IntegerField, SubmitField
from wtforms.validators import DataRequired

class information(FlaskForm):
studentName = StringField('Name', validators=[DataRequired()])
toeflScore = IntegerField('TOEFL', validators=[DataRequired()])
sopScore = IntegerField('SOP', validators=[DataRequired()])
lorScore = IntegerField('LOR', validators=[DataRequired()])


/r/flask
https://redd.it/bf47wz
[P] Python package to easily retrain OpenAI's GPT-2 text-generating model on new texts + Colaboratory Notebook to use it w/ GPU for free

Hi all! I just open-sourced a [Python package on GitHub](https://github.com/minimaxir/gpt-2-simple) that lets you retrain the smaller GPT-2 model on your own text with minimal code! (and without fussing around with the CLI like the original repo)

I have also made a [Colaboratory Notebook](https://colab.research.google.com/drive/1VLG8e7YSEwypxU-noRNhsv5dW4NfTGce) which handles both training w/ a GPU **for free** and file I/O to the notebook (which with GPT-2 is a tad tricker).

Let me know if you have any questions! I plan on releasing more demos soon!

/r/MachineLearning
https://redd.it/bf137p
Anyone hiring Django devs?



Hi, I'm Michael. I've been developing software and web applications for 7 years, proprietary (used by Fortune 500 companies, various colleges, and other clients) and open source.

I have experience in data analysis and visualization (pandas/numpy, highcharts/d3), (including geospatial analysis and visualization (Mapbox, leaflet, Highmaps, Google Maps)), and a bit of machine learning (scikit-learn, numpy).

I typically code in Python/Django, use a PostgreSQL or MySQL database, and use Javascript/Jquery for the front end, though I prefer backend development. I also use git, and I work on a Linux OS.

My latest project is https://datafix.io, which I created in about 150 hours, if you'd like to see some of my work. It's a service where users can either make dataset requests (request that a dataset is created/cleaned), with or without a reward, or make money creating/cleaning these datasets for other users. Please message me with your email for my resume.

Asking for $65k-$85k+ yearly. I am looking for remote, full-time work. I would love a backend role, but I can do full-stack as well

Best, Michael

/r/django
https://redd.it/bf2g7l
Expanding magics

How could I extend the Jupyter Redshift magic module to respond to a commands like %DESCRIBE DOMAIN member, which would then pull catalog info from a Data Calogue and present it to the user as SQL results?

/r/JupyterNotebooks
https://redd.it/bf7oax
Live Data Plotting with Matplotlib

Below is a program I am using to read and plot the value of a sensor (simply a potentiometer at the moment). I am using two DIGI XBEE Pro SX Modems to transceive the data. The majority of the code below is provided by DIGI. The program displays the value of the sensor on the screen but when the compiler reaches the plotting section it simply doesn't execute. There are no errors. I am using Python 3.8, jupyter notebook, and anaconda.

\#########################################################################

from digi.xbee.devices import XBeeDevice

from [digi.xbee.io](https://digi.xbee.io) import IOLine, IOMode

​

import matplotlib.pyplot as plt

import matplotlib.animation as animation

import time

import re

import csv

import serial

import datetime as dt

import math

%matplotlib notebook

​

​

\# TODO: Replace with the serial port where your local module is connected to.

PORT = "COM13"

\# TODO: Replace with the baud rate of your local module.

BAUD\_RATE = 9600

​

REMOTE\_NODE\_ID = "REMOTE"

​

IO\_SAMPLING\_RATE = 1 # 0.5 seconds.

IOLINE\_IN = IOLine.DIO3\_AD3

i=0

​

def main():



\#print(" +----------------------------------------------+")

\#print(" | XBee Python Library Handle IO Samples Sample |")

\#print(" +----------------------------------------------+\\n")

​

device = XBeeDevice(PORT, BAUD\_RATE)

global i

​

try:

[device.open](https://device.open)()

\# Obtain the remote XBee device from the XBee network.

xbee\_network = device.get\_network()

remote\_device = xbee\_network.discover\_device(REMOTE\_NODE\_ID)

if remote\_device is None:

print("Could not find the remote device")

exit(1)

​

\# Set the local device as destination address of the remote.

remote\_device.set\_dest\_address(device.get\_64bit\_addr())

​

\# Enable periodic sampling every IO\_SAMPLING\_RATE seconds in the remote device.

remote\_device.set\_io\_sampling\_rate(IO\_SAMPLING\_RATE)

​

\# Register a

/r/IPython
https://redd.it/bf8dg2