[Tutor] program that 'waits' for file?

Kay White kayrivertree at yahoo.com
Sun Aug 27 17:19:40 CEST 2006

  I'm trying to make a program that will wait for a specific file to be  made by another program, and when that happens it opens and modifies  that file. The other program is a commercial game that allows the  player to take screenshots. It saves the screenshots in a particular  directory, naming each one "screenshot#.bmp". The # is a number that  increases with each new file. 
  Here's a rough plan of my program:
  1. input for user to enter highest numbered screenshot, to determine next "screenshot#.bmp"
  2. function that waits for "screenshot#.bmp" to be created and opens it
  3. function that performs image manipulations
  4. function that saves new image to another directory
  5. close program
  I want my program to run "behind the scenes" so to speak. The user will  start it, enter the highest numbered screenshot they have, and then  start the game. When they take a new screenshot ingame, the resulting  file will be made into a texture on a 3d model that will appear in the  game world.
  I think I can handle the image processing and file writing functions  using PIL, and the ingame model is no problem. But I don't know how to  make my program "wait" for the file to be created. Is this possible,  and if so, can someone show me how to do it?
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060827/8e3eaa2c/attachment.html 

More information about the Tutor mailing list