I created a test tool to check if there are any modules that do not work with pyinstaller so I can work them out before using pyinstaller on my main program.
When I try to interact with files paths in my script it looks like the program that pyinstaller created can not find the paths I have tried to hard code into the script such as "Z:\mkb\crew\mark_conrad\pictures\psd_tool_test_files\test.psd". I decided to use a simply os.path.exists() to debug this mystery but with no luck. When I run my debug program from python console it works just fine so what is going wrong here?
How I generated the exe: pyinstaller "Z:\mkb\programing\python\util\pyinstaller_library_tester.py"
Python version: 2.7.15 PyInstaller version: 3.3.1
Consul output:
Testing: Z:\mkb\crew\mark_conrad\pictures\psd_tool_test_files\test.psd
>>> This path does not exsist.
Path Results: False
Testing: Z:\\mkb\\crew\\mark_conrad\\pictures\\psd_tool_test_files\\test.psd
>>> This path does not exsist.
Path Results: False
Testing: Z:/mkb/crew/mark_conrad/pictures/psd_tool_test_files/test.psd
>>> This path does not exsist.
Path Results: False
Testing: Z://mkb//crew//mark_conrad//pictures//psd_tool_test_files//test.psd
>>> This path does not exsist.
Path Results: False
Debug program Code:
def checkingPaths(path,btn):
import os
if os.path.exists(path):
print '>>> Found a working path use this for your formats for paths'
print 'Path Results:',os.path.exists(path)
btn.configure(bg='#00cc30')
else:
print '>>> This path does not exsist.'
print 'Path Results:',os.path.exists(path)
btn.configure(bg='#ff0000')
def osTest(btn):
print r'Testing: Z:\mkb\crew\mark_conrad\pictures\psd_tool_test_files\test.psd'
checkingPaths("Z:\mkb\crew\mark_conrad\pictures\psd_tool_test_files\test.psd",btn)
print r'Testing: Z:\\mkb\\crew\\mark_conrad\\pictures\\psd_tool_test_files\\test.psd'
checkingPaths("Z:\\mkb\\crew\\mark_conrad\\pictures\\psd_tool_test_files\\test.psd",btn)
print r'Testing: Z:/mkb/crew/mark_conrad/pictures/psd_tool_test_files/test.psd'
checkingPaths("Z:/mkb/crew/mark_conrad/pictures/psd_tool_test_files/test.psd",btn)
print r'Testing: Z://mkb//crew//mark_conrad//pictures//psd_tool_test_files//test.psd'
checkingPaths("Z://mkb//crew//mark_conrad//pictures//psd_tool_test_files//test.psd",btn)
def tkinterTest():
import Tkinter as tk
root = tk.Tk()
osBtn = tk.Button(root,text='os Test',command =lambda: osTest(osBtn))
osBtn.pack(padx=10,pady=2,fill='x')
root.mainloop()
tkinterTest()