path - python code works but not in p2exe executable -
The following code works on its own. I have made executable with py2exe which is not working. The script manages the process and some CSV files, if I put this code in the "dist" directory where executable is executed (hence it is processed in depth of CSV files), the code works; But in the same directory, executable does not work.
In addition to the raw input ("End time", "description", "organization", "location"], index = incorrect) raw_input (press "Enter" to turn off) The statement screen is not open so I can not really see what is happening.
Thanks
Data files as relative paths To dump the dirname (__ file__)
is actually a bad idea, unless you want to run the program in the construction tree only if you want to be able to install and run the program - Whether using py2exe or any other system - you are only asking for trouble.
If you are trying to package files with executables, then how to do this From py2exe
If you can install and use the setuptools
, then with the system, or more powerful and flexible mechanism
If, on the other hand, you install the user to your app After you want to supply CSV files, you almost certainly do not want to put them in your app's directory. Common tasks are to access them as routes related to the current working directory. In other words, just use .
, no dirname (__file__)
.
But, if you really want to do this ... The problem is that __ file____
is the file name of your main script - of course when you run a bundle executable If not then are not useful.
sys.argv [0]
or sys.executable
depending on your usage case.
Comments
Post a Comment