[Tutor] file/subprocess error

Essah Mitges e_mitges at hotmail.com
Thu Jun 11 03:02:47 CEST 2009


But will it work  I run 3 module for this game utilites is just 1

----------------------------------------
> To: tutor at python.org
> From: alan.gauld at btinternet.com
> Date: Wed, 10 Jun 2009 23:57:35 +0100
> Subject: Re: [Tutor] file/subprocess error
>
> "Essah Mitges"  wrote
>> So no one is confused about the error i screenshot it
>
> Thanks.
>
>> I am not sure of the problem
>
> It says it can't find the file.
> Does a file
>
> C:\Users\John Doe\Desktop\WODDS\WODDS\gamelib\data\up-1.png
>
> actually exist? And is it readable by the user running the program?
>
>> When I run the game outside the menu it works fine
>
> Are you running it from the same directory?
>
>> but when I call it as a child window it start then the modules
>> attached cannnot load the games images which couse this
>> error is there a subprocess command to fix this
>
> No, you need to set up the correct environment for the game
> to run before calling subprocess.
>
> However as I and others have pointed out this is almost
> certainly the wrong way to approach your problem, even if
> you can get it to work! You would be better putting the game
> code into a function in Utilities.py and then importing that into
> your menu module. You can then call the game function
> using
>
> import Utilities
>
> # menu code here
>
> Utilities.startGame()
>
> And so that you can still ru n it as Utilities.py add a clause
> at the end of IUtilities.py like
>
> if __name__ == "__main__":
> startGame()
>
>
> HTH,
>
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

_________________________________________________________________
Create a cool, new character for your Windows Live™ Messenger. 
http://go.microsoft.com/?linkid=9656621


More information about the Tutor mailing list