Monday 15 September 2014

python - Loading datafiles with pyinstaller2.0 -


I am working on an application for which it is necessary to load the datafile (PNG files and pot files) using pyinstaller , And I'm tracking the files in the temporary folder, the data files are not added to the temporary folder for some reason. I have created a small module to keep track of the directory, which is as follows:

  import os, sys def resource_path (relative_path): "" "resource Get the full path for, works for dev and try PyInstaller "" for it: # PIInstaller creates a temporary folder and _MEIPASS stores path except the exception in base_path = sys._MEIPASS: base_path = os .path.abspath (".") Returns os.path.join (base_path, relative_path)   

I also modified the spec file:

  A = analysis (['mks_controller.py'], patex = ['c: \\ pyinstaller-2.0 \ \ Pyinstaller-2.0'], hidden = [], hook = none] a.datas + = [(' Presentation.potx ',' C: \\ pyinstaller-2.0 \\ pyinstaller-2.0 \\ bbpresentation.pot X ',' DATA '), (' splat.png ',' C: \\ pyinstaller-2.0 \\ pyinstaller-2.0 \\ splat.png ',' data '), (' logo.png ',' C: \\ pyinstaller-2.0 \\ pyinstaller-2.0 \\ logo.png ',' data ')] pyz = PYZ (a.pure)   

I have the following two commands using the exe Created: pyinstaller.py - Onfile filename pyinstaller.py --onefile filename.sp Ec

More data files are not loaded in the directory . I also tried to run a log that shows all of the files which are in this directory, the data files are not visible here, it has a screenshot:

I have Python 2.7 And am using pyinstaller 2.0 Anyone know what the problem is? Thanks in advance!

Some suggestions from a Noah who have recently gone through the learning curve. There are several things that can give errors without the data files being used before the xi ...

1) Are you using the window? I have created a batch file to run the command (it appears that I will not have to work it) and keep the window open to see the 'break' error messages.

> pyinstaller.py - tab fileename.py
pause

2) I used to open - all the resources to open a file anyway It takes some time, thus spending time during the trial. I put all my data files in a separate directory on the drive for testing and used the full path in my program. These can be manually included in the dist directory and related paths can be determined accordingly in your program, if you are still having trouble working on a file, edit the space file and pack it in a single file Find other errors before being concerned about doing

3) I do not care to edit the imagery file because I do not include data files! 4) I also executed executable via a batch file (because a knot was IM and it had to be turned on again), then with the 'Pause' command so that the window is open and you Can read the errors. 5) Finally, to fix the errors on which I had to switch ('Pythoncom' errors were fixed). To help debug, the dv code looks better because it has less 'warning'. I had to update one module (in my case pyproj) in the latest build. I would recommend that you fix errors with your installed module, update them Various modules maintenance are probably aware of any issues that may have a PI phenster and can be addressed.

No comments:

Post a Comment