2

I try to read my config externally and I want to pack the python project as a single exe otherwise. How can I access the config file automatically from the exe?

My structure:

/
program.exe
config.xml

my project:

/
config.xml
src/
    program.py

note that config.xml should not be part of the exe.

Barney Szabolcs
  • 11,846
  • 12
  • 66
  • 91
  • these might help, http://stackoverflow.com/questions/49146/how-can-i-make-an-exe-file-from-a-python-program and http://www.logix4u.net/component/content/article/27-tutorials/44-how-to-create-windows-executable-exe-from-python-script – Jay T. Feb 23 '16 at 23:13
  • @JayT. thanks for the contribution, can you please tell me where are accessing non-source files mentioned in those links? I could not find that topic there. – Barney Szabolcs Feb 25 '16 at 12:47
  • does this help: http://stackoverflow.com/questions/7567642/where-to-put-a-configuration-file-in-python – Jay T. Feb 25 '16 at 13:41
  • not too sure about this one, but you can give it a look: http://stackoverflow.com/questions/9763403/where-to-put-a-config-file-for-a-compiled-python-script – Jay T. Feb 25 '16 at 13:41
  • I see, so one way is to use appdata and write an installer that copies the config files to appdata... – Barney Szabolcs Feb 25 '16 at 13:50

1 Answers1

0

I just copy the external config file on the root of the EXE or the relative location (if the config file is located on a subdirectory at compile time)

lawrghita
  • 29
  • 6