executable path finding

koranthala koranthala at gmail.com
Mon Aug 31 12:03:13 EDT 2009


Hi,
    I am creating a python application using py2exe. I am facing a
problem which I am not sure how to solve.
    The application contains many other files associated with it -
like icons, config files etc. The executable can be in any directory.
If the user creates a shortcut to the executable to run in desktop,
the program fails - saying that the icon image cannot be found. But I
can run the application properly, if I run it from application
directory - where all the other icons, config files etc are kept.
    How is such issues usually solved? I do not want to hardcode the
paths of icons and store the icons in those paths. I guess, we can
change the directory to the application directory before running the
application. (in __init__.py ???) But how do we find the current
directory in that case? I am completely at sea in solving this.
    This looks to be a very common issue. How is this usually solved?



More information about the Python-list mailing list