Hello fowlertrainer, > Hi ! > > The problem that when I started the program from CMD, the sys.argv is > show the good path (in my machine the c:\dev\xxxx...) from Dialog1.py. > But when I compile it with Py2Exe, and try to start the exe, it has been > not found the hwinfo.ini file what store the setup informations of the > program. This is intensional, py2exe stores some modules in the zip files and want Python to find them first.
> def LoadIniFile():
> s=os.path.dirname(sys.argv[0])+'/hwinfo.ini'
> f=open(s,'r')
> l=(f.read()).split('\n')
> d={}
> for s in l:
> if s.find('=')<>-1:
> sl=s.split('=')
> sl[0]=sl[0].strip().lower()
> sl[1]=sl[1].strip()
> d[sl[0]]=sl[1]
> return d
>
> So that folder is must be correct !
>
> Why I get error ? What I can do if I want to use it as normal py ?
I usually have something like the following in my code.
from os.path import isfile, dirname
from sys import path
APPDIR = path[0] # Application directory
if isfile(APPDIR): # py2exe
APPDIR = dirname(APPDIR)
HTH.
--
------------------------------------------------------------------------
Miki Tebeka <[EMAIL PROTECTED]>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys
pgpNuJI2tMFDr.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list
