[Tutor] Printing

Terry Carroll carroll at tjc.com
Tue Dec 27 20:19:28 CET 2005


On Tue, 27 Dec 2005, John Corry wrote:

> I am saving the code to c:\python24\jhc2.py
> The code creates the file c:\python24\testprint.txt

John, I would *very* strongly advise not to store your code in c:\python24
or any subdirectory in it.  That is where Python itself lives, and it's
very possible that you could create a file with the same name as a
Python-supplied file, and the file you create will start getting
erroneously used instead of the correct one.

I don't know that this is your problem, but it's certainly a factor I 
would eliminate.  Can you tell us what other files, and their names, you 
may have added there?

I have a directory named C:\test where I do my coding.  I generally create 
a subdirectory with some memorable name and work there.  For example, for 
testing your problem out, I have

 C:\
   test\
     print\
      testpr.py
      testpr2.py
      testprint.txt

There may be some differences between what's installed in your Python 
installation and in mine.  I'm a big fan of Activestate's ActivePython.  
It includes most of the Win32-specific stuff you'll need already.  

You may end up needing to re-install Python if you've put too much into
the Python24 directory; if so, I'd suggest you re-install from the
Activestate version.  It's also free, and made to target Windows.  I don't
know of any downsides to using it instead of the Windows release from
Python.org, and it just works.

http://www.activestate.com/Products/ActivePython/?pysbx=1



More information about the Tutor mailing list