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
Code Review request

Would anyone be kind enough to review my project.

It's...rather large and most of it is in spanish (well, spanglish). Do have a readme that I think covers most of it.

https://github.com/DullBlade0/neo-sigia

/r/djangolearning
https://redd.it/6zf3vz
Hey I created my first web app with django and react, on this board you will find all videos, articles and tutorials I used to learn both frameworks
https://mindweb.network/board/build-a-webapp-with-django-and-reactjs

/r/Python
https://redd.it/6zuxbu
ValueError: Unhandled pending operations for models

ValueError: Unhandled pending operations for models:
lists.list (referred to by fields: items.Item.list)


I'm getting this error when I try to migrate. I realized that it recently started happening after I installed django tastypie and started using it to make my API. Not sure what the error is exactly I haven't really modified my models much since then.

/r/django
https://redd.it/6zy179
[D] openAI closing down gym toolkit website

If you go to https://gym.openai.com/ now it just redirects you to their github repo. There was no official statement about it, the site just went down out of the blue. Only source about it actually closing down right now is Greg Brockman's reply on twitter.

https://twitter.com/gdb/status/907855318591438848

> Yep, the Github repo has been the focus of the project for the past year. The Gym site looks cool but hasn't been maintained.


It is really sad news for me personally. The companion website was very useful, both as a benchmark and source of information on practical algo implementations and tricks via writeups. Greg mentioned lack of maintenance, but it I think it was good enough for what it offered.

Maybe if community lets openAI know website will be missed they'll reconsider?

/r/MachineLearning
https://redd.it/6zvlm2
[AF][flask-mail]Recursion error on flask-mail connection attempt

I'm getting a recursion error when I attempt to connect to my hMail server that I set up for testing purposes. Both my Flask server and hMail server are on the same computer at 127.0.0.1. The traceback is as follows:

Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Users\LaNoktaTempesto\myapp\helpers.py", line 47, in send_notice
self.send_message(message)
File "c:\users\LaNoktaTempesto\appdata\local\programs\python\python36-32\lib\site-packages\flask_mail.py", line 502, in send_message
self.send(Message(*args, **kwargs))
File "c:\users\LaNoktaTempesto\appdata\local\programs\python\python36-32\lib\site-packages\flask_mail.py", line 491, in send
with self.connect() as connection:
File "c:\users\LaNoktaTempesto\appdata\local\programs\python\python36-32\lib\site-packages\flask_mail.py", line 506, in connect
app = getattr(self, "app", None) or current_app
File "c:\users\LaNoktaTempesto\appdata\local\programs\python\python36-32\lib\site-packages\flask_mail.py", line 574, in __getatt
r__
[Previous line repeated 319 more times]
RecursionError: maximum recursion depth exceeded

I don't seem to be finding anyone else having this problem, and as I am a beginner, I'm not sure where to start debugging this issue.

/r/flask
https://redd.it/7009m2
How to change directory inside a notebook ?

My project directory typically look like this :

home/
├── data/
│ ├── some.csv
│ ├── another.csv
│ └── etc.csv
├── notebook/
│ ├── myproject.ipynb
│ └── testing.ipynb
└── src/
└── script.py

I have set my configuration to launch my notebook in the home directory. Although I am having trouble properly loading files from the data directory.

My big challenge is that I am using Windows, Linux and Mac. I've used the OS module but my code doesn't work will all OS.
I can't find the universal code that would allow me to move from the notebook to the data.

Any help ?

/r/IPython
https://redd.it/702c9h
Best practices for group projects?

For uni we have to do a ML group project in Jupyter. Putting together our code manually is quite a pain in the ass. However, git has a lot of conflict problems when cells are added/deleted which take even more time to solve than manually putting together the code.

What are your workflows in group projects?

Thanks so much!

/r/IPython
https://redd.it/702spv
Can Python check if some security cameras have been covered or saturated with artificial lights?

Hi everyone,
I'm working on a Debian server (version 8) that captures some h.264 streams from security cameras with ffmpeg, and stores them in chunks of 1 minute long mp4 videos.
My task is the following: Check if the cameras have been covered (have gone dark), or some light have been pointed directly into the camera so it's saturated (completely white).

The "dark check" has to keep into account that on the stream there are some white timestamps, a logo and some noise, so it's never completely dark, even if you paint over the camera lens with a spry can.

I was thinking about this solution:

1) For every minute long video, extract the middle frame with ffmpeg into a jpg file
2) I analyze the jpg file with python to extract the average brightness.
3) If the brightness is close to "0" (8 bit black) or "255" (8 bit white) it will trigger a warning

The server has about 40 cameras recording 24/7 and of course the computational load of the "dark" and "white" check must be as low as possible.

Do you think my approach is reasonable? Could I do this with other tools?

I was thinking about OpenCV to extract the frame instead of ffmpeg to keep everything in RAM but I don't really know the library.

Thanks in advance.

/r/Python
https://redd.it/70366e
Are there any up to date React + Django integration tutorials?

Hey there,

I'm looking to go SPA with my django site using React. I have the API set up using DRF.

I started using [the excellent tutorial that /u/gammadog posted here back in February,](https://www.reddit.com/r/django/comments/43y4wd/a_tutorial_on_using_django_rest_framework_with/), but it looks like React's syntax has been updated quite a lot since then and his tutorial is no longer effective. I'm doing my best to bushwhack a path using documentation and other online tutorials. However, I am consistently hitting very frustrating roadblocks.

Do any of you know a good, up to date tutorial to get all my pieces communicating with one another effectively?

Thanks!

/r/django
https://redd.it/704mno
Django on Raspberry Pi, interacting with sensor network and alerts

I'm working on a system to monitor some sensors and provide feedback on certain conditions. Normally I'd just write something like this in C++ or python because it's straightforward and not complicated, but we've decided to integrate a display for constant readout. It seems to make sense to use Django for the datastore and the display portions, something that Django is awesome at. Since all the sensors will be available across an ethernet, I'll just make a simple REST api for reporting updates and then use django/javascript to show system status on a display.

Does anyone have any pointers or suggestions for the above setup? I'll be writing a python system utility that will run and keep track of everything and interact with the database, probably through management commands. Or is interacting over REST a better option?

If I'm pulling in about 300 readings per minute, do I need to worry about purging data over time, or will postgres be ok for this? Historical data (>10 days) is not super important for this system.

Anyone else have feedback or advice on deploying django on rpi? It's on a local network and will basically just have a small handful of users.

Thanks!

/r/django
https://redd.it/703mh2