Pygbag seems to block when downloading numpy on big projects - python

I am trying to use pygbag on a pygame project and every time I try to run it, the site stops working after downloading numpy.
I have tried with small projects and everything seems to work just fine even when downloading numpy but when I try with my big project it just stops after downloading it, and I can't find anything that would help me understand where the problem is in the pygbag github page.
Any idea on how I could fix this ?
Everything just stops after this line in the debug window

Related

How to run github code contains .py, .xml, .json files using VS Code

I downloaded a code from github and I tried running it with VSCode, actually I'm a beginner in all that. Can anyone give a hint for starting the code. I tried downloading several python versions and many environments but idk what to do right now. The code contains json and xml files.
Any comment, even if it is simple, is very grateful.
This is the repository
https://github.com/edosavini/TransferBertSarcasm
......................................................

Getting "Premature end of script headers" on Dreamhost Python Webpage

I have a webpage made in Python Flask with Python 2.7 (I know), hosted on Dreamhost. Up until a few days ago I had absolutely no problems. Then, I started getting a permission error on my page. I don't know what happened, but I got with Dreamhost live chat and they solved it by doing a chmod 755 to my files. Everything was working again, but on further inspection, all the parts that generate a PDF document in my webpage have stopped working. The error that I am getting in the error logs is "Premature end of script headers".
This error only appears whenever I try to generate a PDF. The code works perfectly on my local environment, but it does not work on the hosting. I got with the people of Dreamhost again and they said that it was nothing on their side. Which is weird considering that the code that was ALREADY WORKING was not changed at all. I tried debugging on my part but I am not getting any errors.
I have tried pretty much everything I can think of to solve this situation but I have been unsuccessful. The course of action is to change this hosting (it was a mistake on my part to use Dreamhost in the first place, I know. But when I made this I was just starting and I had very little knowledge). But I need a quicker solution for the moment, and I was wondering if anyone has had this problem and could maybe help me out with this.
To elaborate, I am using Python 2.7, the library that is used for the PDF creation is Flask-Weasyprint (0.5). I tried running the wsgi file myself, and I am getting the following message:
/path/to/local/lib/python2.7/site-packages/WeasyPrint-0.39-py2.7.egg/weasyprint/text.py:29: UserWarning: There are known rendering problems with Cairo <= 1.14.0
warnings.warn('There are known rendering problems with Cairo <= 1.14.0')
/path/to/local/lib/python2.7/site-packages/WeasyPrint-0.39-py2.7.egg/weasyprint/fonts.py:46: UserWarning: #font-face support needs Pango >= 1.38
warnings.warn('#font-face support needs Pango >= 1.38')
I know that I should change to Python 3. When I made this web app, Dreamhost only accepted Python 2 and I barely had any knowledge of creating VPS or something like that. It is my plan to change hosting soon to a virtual machine and to run the project in Python 3. But I need a solution for this now before I go on.
Any help will be appreciated. If you need more details please let me know.
This may be due to the Passenger file not including your project directory in its path. One solution is adding the following to your passenger_wsgi.py file:
sys.path.append(os.getcwd()+"/<project_name>")

Minimum code for mDNS browsing

I'm developing a Sublime Text plugin to work with IoT devices. Some of that hardwares have the option to upload the code by OTA (over the air) and I need to be able to discover the device by mDNS.
I've tried with zeroconf and it works very well, I just need to set the browser like that:
browser = ServiceBrowser(zeroconf, "_arduino._tcp.local.", listener)
So, what is the problem?
Sublime Text runs the plugins in it's own simplified version, so the only way to run an external package is downloading and integrating it into the plugin code. all is fine there, I've done with other packages without problem.
zeroconf has the following dependencies: enum-compat, netifaces, six and some of that dependencies has its own dependencies.
I tried downloading each dependency (and it seems to much code only to browse), but the main problem is that netifaces is written in C. I tested some things to try to make it work but I didn't make it.
I've also tried with this repository zeroconf It's and old version of the zeroconf above and not need the netifaces dependence. The code to browse is the same in both cases, but in this old version it's not getting any arduino device.
So what do I need?
I would like to get help with a code to browse/discover the arduino devices, as I previously described the main goal is get a minimum code to this task and run without install any dependence. I mean download the depedence if it needs and execute it locally.
I don't want someone to write me the code, but someone to may point me where can I start.
I've been looking the zeroconf code and it seems that it's not possible to work without netifaces, and that is the reason why the old repository didn't find the devices.
I've also tried with:
mdns This seems to be a non dependence code, but there is not documentation, so I didn't make it work
mdns-lookup It find other devices, but not the arduino/esp type

Getting Kivy running with Python on Winpython

I've done tons of research on my issues, and I haven't really found an answer:
I'm trying to use Kivy in Eclipse on my computer. I've got an environment setup already, and I installed Kivy and the dependencies just like this:
https://kivy.org/docs/installation/installation-windows.html#
I copied the first bit of code from the tutorial on their site which should simply make a blank window, and upon running I got this error:
sdl2 - Exception: SDL2: Unable to load image
...
[CRITICAL ] [App ] Unable to get a Window, abort.
Just from that, I found tons of people with the same issue. issue 3002 on kivy's github (sorry, I can't put too many links) suggests solutions for linux users, which doesn't help me.
This: Trying to run KIVY, for the first time suggests installing pygame, which I've done multiple times, but it looks like the last update for pygame was in 2009? (I looked at their main site)
Either way, I installed pygame and that didn't change a thing. I also looked at issue 3491 (again, can't post more than 2 links) which seems very applicable but suggests downloading drivers from my GPU vendor, which I have no idea how to do, or what GPU I even have.
Is there any solution to my problem? Do I have to try and figure out how to get correct drivers? Also, I am using WinPython if that matters, but it seems to work for everything else...
Paste output of echo %PATH% here. Feel free to cut of personal things, I only want to know if sdl2 is available on the path (which I think is not). If not, add it. Should look like this:
<python.exe dir>\share\sdl2\bin
If it doesn't work for you, well... I'm still sure it's deps & path-related error. I usually annoy people with a link to my installer's github repo when I see similar error. I have there this line:
set PATH=%~dp0;%~dp0Tools;%~dp0Scripts;%~dp0share\sdl2\bin;%~dp0Lib\idlelib;%PATH%
Put <python dir>\Scripts on path too, because of garden, pip and other stuff.

Flask mega tutorial part 5 error

Im going through the Microblog tutorial for Flask designed by Miguel.
I made it to part 4 without any issues. Everything ran in the end of part 4.
I started having issues in part 5. After a couple of tries and trying to troubleshoot with the comments in the page, I was not able to finish the exercise.
Thinking it was me, I deleted all of my project and replaced them with the zip downloadable in the page for the exercise. I still get the same error, so the problem is not the code itself.
I get the following error when running views.py:
Link to image on imgur (couldn't post it here due to not having enough reputation)
Here are the libraries I have installed:
Link to image on imgur (couldn't post it here due to not having enough reputation)
My setup:
I am using Pycharm to run the files. This machine runs Windows and I found that Pycharm is the most efficient way to run things without dealing with issues with the cmd line.
Python 3.4
virtualenv created by Pycharm
the code can be found on github: github.com/pdgonzalez872/microblog
Potential cause of the problem:
The problem may be with the path that I have set up (but why did it work until part 4?)
The code itself (maybe something was updated in flask/other libraries since the post?)
views.py isn't meant to be launched separately, there is run.py file to start the project.
Also, it uses relative imports (those with dots before module names), which don't work when you use them in a script passed to the interpreter and used as main. Sorry, I can't explain it well, but maybe you will be interested in those links:
https://docs.python.org/2/tutorial/modules.html#intra-package-references
How to do relative imports in Python?

Categories