In article <[EMAIL PROTECTED]>,
 Giovanni Bajo <[EMAIL PROTECTED]> wrote:

> On 20/01/2007 2.22, Russell E Owen wrote:
> 
> > The code works fine for py2app and py2exe, relying on the
> > useful attribute that __file__ is correct for modules.
> > Also, sys.executable is absolute for py2app (I don't know about py2exe).
> > pyinstaller has neither and I'm stumped.
> > 
> > Any suggestions?
> > 
> > Or...any idea how hard it would be to modify pyinstaller to provide 
> > an absolute sys.executable or usable module __file__ attributes? I've 
> > not looked at the source code yet.
> 
> You are raising good points here.
> 
> About sys.executable, it should be pretty easy to fix it. Have a look at 
> source/linux/main.c, you should find a good place to drop your fix in there.

Thank you for the pointer. I'll have a look.

> About __file__, why do you consider it "dead wrong"? What's the current 
> contents of __file__ for you, and what would you like it to be?

I would like <module>.__file__ to be the absolute path to the current 
location of that module -- even if the package is moved (e.g. installed 
on some other user's computer).

That is the current behavior for python and for py2exe and py2app 
bundled apps. It allows easy use of <module>.__file__ to find resources 
with just a few minor tricks in the case of bundled applications.

Instead what I find is that <module>.__file__ points to a file in my 
*build* directory (thus a file that may no longer exist).

For example, after building my application "tui" I have subdirectories 
buildtui and disttui. The final files are in disttui, but when I run 
disttui/tui I find that <module>.__file__ refers to buildtui/out5.pyz:

TUI.__file__ =
/astro/users/rowen/build/TUI_1.3a15_Source/BuildForUnix/buildtui/out5.pyz
RO.__file__ =
/astro/users/rowen/build/TUI_1.3a15_Source/BuildForUnix/buildtui/out5.pyz

The correct path should be somewhere in disttui (I'm guessing 
disttui/tui.pkg).

Any idea what it would take to do this?

-- Russell


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/PyInstaller?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to