I am having an issue with a program, which uses panda3d. It works perfectly when executed as a pythonscript, but the version, which is compiled (or rather packaged) by PyInstaller throws the exception below.
:display(warning): Unable to load libpandagl.so: No error.
Known pipe types:
(all display modules loaded.)
Traceback (most recent call last):
File "Shipsim3d_1-1.py", line 930, in <module>
File "Shipsim3d_1-1.py", line 23, in __init__
File "direct/showbase/ShowBase.py", line 339, in __init__
File "direct/showbase/ShowBase.py", line 1024, in openDefaultWindow
File "direct/showbase/ShowBase.py", line 1059, in openMainWindow
File "direct/showbase/ShowBase.py", line 769, in openWindow
File "direct/showbase/ShowBase.py", line 749, in <lambda>
File "direct/showbase/ShowBase.py", line 821, in _doOpenWindow
File "direct/showbase/ShowBase.py", line 650, in makeDefaultPipe
File "direct/directnotify/Notifier.py", line 130, in error
Exception: No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.
[5466] Failed to execute script 'Shipsim3d_1-1' due to unhandled exception!
Usually, there is a Config.prc file in the etc subdirectory of the panda3d site-package directory. This file is non-existent in the packaged version. But if I create this subdirectory there, and copy the files to it as well, it still doesn't work and it still throws the same exception. There is a line "loadPrcData("win-size 1080 1920")" in my main program as well. Could this be part of the problem in any way? Or is there something else i am missing?
Thanks in advance
I solved this problem by including the whole panda3d lib:
pyinstaller --add-data="path/to/panda3d;panda3d" -wF main.py
Related
I am having an issue with a program, which uses panda3d. It works perfectly when executed as a pythonscript, but the version, which is compiled (or rather packaged) by PyInstaller throws the exception below.
:display(warning): Unable to load libpandagl.so: No error.
Known pipe types:
(all display modules loaded.)
Traceback (most recent call last):
File "Shipsim3d_1-1.py", line 930, in <module>
File "Shipsim3d_1-1.py", line 23, in __init__
File "direct/showbase/ShowBase.py", line 339, in __init__
File "direct/showbase/ShowBase.py", line 1024, in openDefaultWindow
File "direct/showbase/ShowBase.py", line 1059, in openMainWindow
File "direct/showbase/ShowBase.py", line 769, in openWindow
File "direct/showbase/ShowBase.py", line 749, in <lambda>
File "direct/showbase/ShowBase.py", line 821, in _doOpenWindow
File "direct/showbase/ShowBase.py", line 650, in makeDefaultPipe
File "direct/directnotify/Notifier.py", line 130, in error
Exception: No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.
[5466] Failed to execute script 'Shipsim3d_1-1' due to unhandled exception!
The .prc file doesn't exist in the executable, but even if I copy it there manually, it still doesn't work. In my Code, I use a function called loadPrcData. Is that a Part of the problem? Or is it something else?
Thanks in advance
I recently have packaged a python app using the pyinstaller --onefile command. It succesfully makes a executable file that launches fine. I can use pretty much almost all the functions in my script with no problem, except one. When I call a function of another python file (which is in my app folder), I get this error:
Traceback (most recent call last):
File "socketserver.py", line 647, in process_request_thread
File "socketserver.py", line 357, in finish_request
File "socketserver.py", line 717, in __init__
File "http/server.py", line 426, in handle
File "http/server.py", line 414, in handle_one_request
File "CaptchaHarvester/harvester/server/__init__.py", line 134, in do_GET
File "CaptchaHarvester/harvester/server/__init__.py", line 178, in handel_request
File "CaptchaHarvester/harvester/server/__init__.py", line 85, in _load_template
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/rl/rmr5s0ld22j0h_z15m90v0c80000gr/T/_MEIBVnHEv/harvester/server/templates/ga.chunk.html'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 54955)
Traceback (most recent call last):
File "socketserver.py", line 647, in process_request_thread
File "socketserver.py", line 357, in finish_request
File "socketserver.py", line 717, in __init__
File "http/server.py", line 426, in handle
File "http/server.py", line 414, in handle_one_request
File "CaptchaHarvester/harvester/server/__init__.py", line 122, in do_GET
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/rl/rmr5s0ld22j0h_z15m90v0c80000gr/T/_MEIBVnHEv/harvester/server/icon.png'
The problem seems to be that pyinstaller cant properly find the files(icon.png and ga.hunk.html). These files are in a folder that is in the same folder as my main.py file. I was wondering how I can make pyinstaller find these files succesfully? I have tried to add to the datas class in the .spec file, but I still get the error. This is what that line looks like:datas=[('/Users/A/Desktop/ss/CaptchaHarvester/harvester/server/icon.png','/Users/A/Desktop/ss/CaptchaHarvester/harvester/server')],
Please let me know if I am doing something wrong or if yall have any ideas on how to resolve it.
I am on macosx catalina and python 3.7 if that is any help.
Thanks!
You can use arguments in command prompt to ensure the correct filesare found by pyinstaller; --add-data "path_to_file:path_in_executable in directory" an example would be
pyinstaller --add-data "icon.png;." --onefile socketserver.py
here icon.png is in the same directoy of socketserver.py and is copied to the root directory of the executable (the . signifies root directory)
I am trying to convert a python file into an executable and for that I'm using py2exe. When running the setup.py script to generate the dist folder and the executable file everything goes well.
What goes wrong is that when I'm running the executable the following error message gets displayed:
Traceback (most recent call last):
File "q400.py", line 16, in <module>
File "SUAVE\__init__.pyc", line 12, in <module>
File "SUAVE\Plugins\__init__.pyc", line 11, in <module>
File "SUAVE\Plugins\load_plugin.pyc", line 37, in load_plugin
File "SUAVE\Plugins\pint\__init__.pyc", line 23, in <module>
File "SUAVE\Plugins\pint\unit.pyc", line 423, in __init__
File "pkg_resources\__init__.pyc", line 1171, in resource_filename
File "pkg_resources\__init__.pyc", line 1872, in get_resource_filename
NotImplementedError: resource_filename() only supported for .egg, not .zip
When I check the file unit.pyc at line 423 the code is:
data = pkg_resources.resource_filename(__name__, 'default_en.txt')
And when I check the library.zip in the dist folder there is no default_en.txt file, however, it is present in the site-packages module.
So is it because this file is a txt file that this error shows up?
I tried to force py2exe to import it but with no success.
Also I found a similar question here but the answer can't be applied in my case because I don't have any egg nor zip files implicated in the error (at least in my opinion).
Thank you
Questions with similar issue:
Parallel Python - too many files and Python too many open files (subprocesses)
I am using Parallel Python [V1.6.2] to run tasks. The task processes an input file and outputs a log/report. Say, there are 10 folders each with 5000 ~ 20000 files which are read in parallel, processed and logs written out. Each file is approx 50KB ~ 250KB
After ~6 Hours of running, Parallel Python fails with the following error.
File "/usr/local/lib/python2.7/dist-packages/pp-1.6.2-py2.7.egg/pp.py", line 342, in __init__
File "/usr/local/lib/python2.7/dist-packages/pp-1.6.2-py2.7.egg/pp.py", line 506, in set_ncpus
File "/usr/local/lib/python2.7/dist-packages/pp-1.6.2-py2.7.egg/pp.py", line 140, in __init__
File "/usr/local/lib/python2.7/dist-packages/pp-1.6.2-py2.7.egg/pp.py", line 146, in start
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
File "/usr/lib/python2.7/subprocess.py", line 1135, in _execute_child
File "/usr/lib/python2.7/subprocess.py", line 1091, in pipe_cloexec
OSError: [Errno 24] Too many open files
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 66, in apport_excepthook
ImportError: No module named fileutils
Original exception was:
Traceback (most recent call last):
File "PARALLEL_TEST.py", line 746, in <module>
File "/usr/local/lib/python2.7/dist-packages/pp-1.6.2-py2.7.egg/pp.py", line 342, in __init__
File "/usr/local/lib/python2.7/dist-packages/pp-1.6.2-py2.7.egg/pp.py", line 506, in set_ncpus
File "/usr/local/lib/python2.7/dist-packages/pp-1.6.2-py2.7.egg/pp.py", line 140, in __init__
File "/usr/local/lib/python2.7/dist-packages/pp-1.6.2-py2.7.egg/pp.py", line 146, in start
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
File "/usr/lib/python2.7/subprocess.py", line 1135, in _execute_child
File "/usr/lib/python2.7/subprocess.py", line 1091, in pipe_cloexec
OSError: [Errno 24] Too many open files
While I understand, this could be the issue in subprocess pointed out here http://bugs.python.org/issue2320, but, seems the solution is only part of Py V3.2. I am currently tied to Py V2.7.
I would like to know if the following suggestion helps:
[1]http://www.parallelpython.com/component/option,com_smf/Itemid,1/topic,313.0
*) Adding worker.t.close() in destroy() method of /usr/local/lib/python2.7/dist-packages/pp-1.6.2-py2.7.egg/pp.py
*) Increasing BROADCAST_INTERVAL in /usr/local/lib/python2.7/dist-packages/pp-1.6.2-py2.7.egg/ppauto.py
I would like to know if there is a fix available/Work Around for this issue in Python V2.7.
Thanks in Advance
My team recently stumbled upon a similar issue with the same file handle resource exhaustion issue while running celeryd task queue jobs. I believe the OP has nailed it and it's most likely the messy code in suprocess.py lib in Python 2.7 and Python 3.1.
As suggested in , Python Bug#2320, please pass in close_fds=True everywhere you call subprocess.Popen(). In fact they make that a default in Python 3.2 while also fixing the underlying race condition issue. See more details in that ticket.
I had left at some lines to destroy the job servers. job_server.destroy() fixes the issue.
So I'm confused about how to get pyinstaller to build an application that uses win32com. I have a script that runs with no problem from IDLE or command line that interacts with excel via
xl = Dispatch('Excel.Application')
followed by some other really basic excel calls, then closes. I've seen advice to include "clsctx=pythoncom.CLSCTX_LOCAL_SERVER" as an argument to Dispatch, but it doesn't change anything. Whenever I build the script, I get an error similar to this
Traceback (most recent call last):
File "<string>", line 7, in <module>
File "C:\Python27\trunk\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Python27\trunk\iu.py", line 521, in doimport
exec co in mod.__dict__
File "Myskript\build\pyi.win32\Myskript\outPYZ1.pyz/win32com.client", line 11,
in <module>
File "C:\Python27\trunk\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Python27\trunk\iu.py", line 521, in doimport
exec co in mod.__dict__
File "Myskript\build\pyi.win32\Myskript\outPYZ1.pyz/win32com.client.gencache",
line 662, in <module>
File "Myskript\build\pyi.win32\Myskript\outPYZ1.pyz/win32com.client.gencache",
line 58, in __init__
File "Myskript\build\pyi.win32\Myskript\outPYZ1.pyz/win32com.client.gencache",
line 649, in Rebuild
File "Myskript\build\pyi.win32\Myskript\outPYZ1.pyz/win32com.client.gencache",
line 65, in _SaveDicts
File "Myskript\build\pyi.win32\Myskript\outPYZ1.pyz/win32com.client.gencache",
line 141, in GetGeneratePath
IOError: [Errno 22] invalid mode ('w') or filename: 'C:\\Python27\\trunk\\Myskri
pt\\dist\\Myskript.exe?844863\\__init__.py'
That's copied from this german question http://www.python-forum.de/viewtopic.php?f=1&t=25010 but my error is basically the same. I tried to implement the advice given on that page to no avail either.
I know next to nothing about COM stuff, just hoping to get this little excel app to run.
EDIT: Also tried importing pythoncom and running "CoInitialize()" (based on this guy Call MS Access module function from Python after compiling with py2exe fails saying that his script ran fine with pyinstaller) but that didn't change anything either. Really at a loss here and appreciate any advice.
I'm not sure if you are still using py2exe, i was about to try your workaround when i stumbled into this thread:
Call MS Access module function from Python after compiling with py2exe fails
The "solution" was using Pyinstaller that has a bunch of workarounds implemented on by default depending on your script. I tried it with my pywin32 script that uses excel and word com objects and it worked perfectly without any tweaks.