[wxPython-users] a couple of scary moments in wxpython under
win32 under py2exe with a ridiculous deadline thrown in...
Brian Martin
thebrianmartin at gmail.com
Tue Aug 14 13:40:19 PDT 2007
Of course.. You're right, it was the FileDialog component!
I know cwd is bad. I wasn't even thinking that. I was assuming maybe python
had some default behaviour to check the current directory the application
was sitting in.
thanks man
On 8/14/07, Nitro <nitro at dr-code.org> wrote:
>
> Am 14.08.2007, 22:11 Uhr, schrieb Brian Martin <thebrianmartin at gmail.com>:
>
> > Just some weird things that happened during my project that I wanted to
> > share....
> >
> > 1) For simplicity sake (and because my installer knowledge was minimal),
> > I was just putting icons and logos for my application in the root
> > directory
> > of the source folder. When I would refer
> > to them when creating an image for example i could just exclude any path
> > information (ie. 'foo.img' vs 'c:\Program Files\proj\foo.img') and
> > wxpython (or python) would know how to get them. Then, when adding a
> > feature
> > to allow someone to add a custom graphic to the application I make a
> > call to
> > shutil.copy to move the image from a user location into the source tree.
> > As
> > soon as I do this, wxpython could not find any of my images or icons. I
> > had
> > to explicitly point to them or it would barf. Now this is probably the
> > best
> > way to do it and I just made a global constant which used sys.path[0].
> > Regardless, it was interesting. Mid-application, references to these
> > images
> > were broken when i called the shutil.copy command.
>
> Well, this has probably nothing to do with the shutil.copy command. I
> suspect you've shown some FileDialog thing. This changes the cwd
> sometimes. Since you did not specify absolute pathnames for your images (I
> do this always in my app, imo the concept of a cwd should be completely
> eliminated from all OSes. It's just an excuse for being lazy imo) wxPython
> can suddenly not find them anymore. Never rely on the cwd! For example if
> you start your application from "c:\" (by typing "c:\program files\my
> app\myapp.exe") then your cwd will be c:\ and *not* the path where your
> .exe resides in. Thus everything stops working.
> Moral of the story: Never rely on the cwd.
>
> -Matthias
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200708=
14/99ea7307/attachment.htm
More information about the wxpython-users
mailing list