It is an IDLE problem - I ran into the same thing on Ubuntu and XP, IDLE doesn't like the way they do it. A simple fix is to just put this line in: sys.path.insert(0, "lib") Instead of all that try/except nonsense. The above line works just as well, and I have never had a problem with it failing anywhere. I have actually used that stuff in my teams entry for pyweek ever sense the skellington was released :)
HTH :) On Tue, Feb 10, 2009 at 11:40 AM, Brian Fisher <[email protected]>wrote: > I can reproduce the problem (on vista), but it looks like an idle problem, > not really a vista problem > > when running the script, "__file__" is "C:\Python25\Lib\idlelib\idle.pyw" > > so "libdir" becomes "C:\Python25\Lib\idlelib\lib" > > > > > On Tue, Feb 10, 2009 at 2:48 AM, Thiago Chaves <[email protected]>wrote: > >> Can anyone in the list also reply if they do NOT get problems running >> programs with skellington-compliant structure on Vista? So far I've >> got only one person informing of problems executing the program and >> I'd like to hear if that's widespread or not. >> >> -Thiago >> >> On Sun, Feb 8, 2009 at 10:02 PM, Thiago Chaves <[email protected]> >> wrote: >> > Hi, >> > >> > recently I was informed that my most recent project is not running >> > properly in Vista. I'm using the skellington structure suggested by >> > Pyweek administration and I'm wondering if that's somehow related. >> > >> > File structure for the project (as far as it is relevant to this post): >> > ssof/run_game.py >> > ssof/lib/main.py >> > >> > run_game.py's contents: >> > >> > ____________________ >> > #! /usr/bin/env python >> > >> > import sys >> > import os >> > >> > >> > try: >> > __file__ >> > except NameError: >> > pass >> > else: >> > libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), >> 'lib')) >> > sys.path.insert(0, libdir) >> > >> > import main >> > main.main() >> > _______________ >> > >> > User feedback: >> > >> > Alright then, >> > Open fully-updated Windows Vista. Open IDLE. Python version number is >> > 2.5.2. Open run_game.py. Hit F5 (runs the script). >> > Traceback (most recent call last): >> > File "C:\Users\Andy >> > Hanson\Desktop\ssof-2009-01-31-fixed\ssof_alpha4\run_game.py", line >> > 15, in <module> >> > import main >> > ImportError: No module named main >> > >> > This is certainly a very simple problem! >> > >> > ________________ >> > >> > Any thoughts? What am I doing wrong here? >> > >> > (I'm attaching run_game.py just in case the formatting gets messed up) >> > >> > -Thiago >> > >> > >
