473,471 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

wxPy + Py2Exe + sys.argv[0]

Hi !

I have been finished my WMI information getter simple application, but
the exe is not working as like the py modules before compilation.

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 file is write by my hand, and I place it with Dialog1.exe (in same
directory).

But the compiled exe is not use the good path... It use "/" only.

When I started it from CMD with Dialog1.exe, it hasn't been found the
ini file:

Traceback (most recent call last):
File "Dialog1.py", line 269, in ?
File "Dialog1.py", line 201, in LoadIniFile
IOError: [Errno 2] No such file or directory: '/hwinfo.ini'

When I use full path: c:\dev\xxxx\Dialog1.exe, it have been found
everything, and working good.
I don't understand it, because I working with sys.argv[0], with this method:

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 ?

Thanx for help:
ft

Jul 21 '05 #1
0 990

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Peter Teniz | last post by:
hi, i'm trying to generate a service for win XP / win 2k with python2.3.3 + win32all-163 + py2exe0.5.0 (also tried with pywin32-200.win32-py2.3) running the console-script "FBxmlserv.py" with...
3
by: Werner Merkl | last post by:
Hi, Python is really great, for small to big programs. For my colleagues and some circumstances I sometimes need to "compile" a script using py2exe. Cause I use Windows, I like to use the...
4
by: bwaha | last post by:
First time trying to create an executable with py2exe. I have a small program which makes use of python23 (2.3.5?), wxpython ('2.6.2.1'), matplotlib ('0.83.2'), win32com (latest?), Numeric...
0
bartonc
by: bartonc | last post by:
You can find the original author of the script by ggling " Py2Exe version 6.3 setup" The cool thing about this is that it calls py2exe, just in case you're uncomfortable with the command line. I had...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.