Re: [Tutor] file/subprocess error

2009-06-11 Thread Alan Gauld


Essah Mitges e_mit...@hotmail.com wrote 


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


It doesn't matter how many modules you use, although it 
changes how many you have to import maybe. But in princiople 
if your game is started by calling a single function then you 
only need to import the module with that function.


BTW You still haven't answered the question:


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?



Alan G.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] file/subprocess error

2009-06-10 Thread Wayne
On Wed, Jun 10, 2009 at 4:00 PM, Essah Mitges e_mit...@hotmail.com wrote:


 So no one is confused about the error i screenshot it I am not sure of the
 problemWhen I run the game outside the menu it works fine 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 thisTried
 python.org btw


The last error specifically tells you what it is and what is wrong:

pygame.error: Couldn't open data\up-1-.png

it can't find that file. Are you sure it exists?
HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] file/subprocess error

2009-06-10 Thread Alan Gauld
Essah Mitges e_mit...@hotmail.com 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@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] file/subprocess error

2009-06-10 Thread Essah Mitges

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


 To: tutor@python.org
 From: alan.ga...@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@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
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor