Edit 3: I replaced __file__
with sys.argv[0]
when I need to know the location of my script / executable. This is not exactly the same, but in my case it works fine (at least on the executable version ...). Now everything works fine, in single-file mode, using the accepted response function to access resource files!
Edit 2: as shown in the accepted answers, the problem arises from the path resolution in my script; I am trying to use __file__
to get the location of a script so that I can access its resource files. This does not work after packaging, as __file__
returns the file name from Python.dll
to the script, so there is always no path and just the file name. So I have to find another trick to make access to resource files; The workaround at the moment is to move the current directory to the executable path.
By the way, this means that ConfigParser should report a problem while accessing the file, and not that the section is missing.
I will update this question with how I resolved this path resolution question.
I have problems with pyinstaller
, and since it is the first time I use it, it is sure that I did something wrong.
So here is the problem: pyisntaller
runs smoothly on the script I wrote and generates some things in the dist
folder. So now I want to execute it to see if everything is fine, and here is what I get:
C:\Program Files\PyInstaller\pyinstaller-1.5.1>p_tool\dist\p_tool\p_tool.exe -? Traceback (most recent call last): File "<string>", line 104, in <module> File "p_tool\build\pyi.win32\p_tool\outPYZ1.pyz/logging.config", line 76, in f ileConfig File "p_tool\build\pyi.win32\p_tool\outPYZ1.pyz/logging.config", line 112, in _create_formatters File "p_tool\build\pyi.win32\p_tool\outPYZ1.pyz/ConfigParser", line 532, in ge t ConfigParser.NoSectionError: No section: 'formatters'
My first idea was that the logging.conf
file logging.conf
missing, so I added it (and some other resource files) to the p_tool.spec
file, but this is not better.
Python version: 2.6.6 under WinXP. I am using pyinstaller
since I will need it for batch files for a Solaris workstation.
So, did anyone have this problem? The only topic is related to the following question: PyInstaller problem , really close to my problem, but hopelessly it did not receive an answer.
Edit3: Log deletion information was deleted because it is not related to the problem.