Re: How to create a file on users XP desktop

2007-10-07 Thread Craig Howard

On Oct 6, 2007, at 11:31 PM, goldtech wrote:

 Can anyone link me or explain the following:

 I open a file in a python script. I want the new file's location to be
 on the user's desktop in a Windows XP environment.  fileHandle = open
 (., 'w' )  what I guess I'm looking for is an environmental
 variable that will usually be correct on most XP desktops and will
 work in the open statement. Or is there another way?

 Thanks

 -- 
 http://mail.python.org/mailman/listinfo/python-list

import os.path
home = os.path.expanduser('~')
desktop = os.path.join(home, 'Desktop')
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: unit testing

2007-10-05 Thread Craig Howard

On Oct 4, 2007, at 3:02 PM, brad wrote:

 Does anyone else feel that unittesting is too much work? Not in  
 general,
 just the official unittest module for small to medium sized projects?

 It seems easier to write some quick methods that are used when needed
 rather than building a program with integrated unittesting. I see the
 value of it (the official unittest that is)... especially when  
 there's a
 lot of source code. But this...

 if len(x) != y:
 sys.exit('...')

 is a hell of a lot easier and quicker that subclassing  
 unittest.TestCase
 on small projects :)

 Do others do their own informal unit testing?

 Just curious,

 Brad
 -- 
 http://mail.python.org/mailman/listinfo/python-list

Brad:

If the program is more than 100 lines or is a critical system, I  
write a unit test. I hate asking myself, Did I break something?  
every time I decide to refactor a small section of code. For  
instance, I wrote an alarm system in Python for a water treatment  
plant. If the chlorine, pH, or turbidity are out of spec, an email  
message is sent to the plant operator's pager. Because of the nature  
of the alarm system, extensive field testing was out of the question.  
Unit testing was the only way to ensure it worked without disrupting  
the plant operation.

Craig

-- 
http://mail.python.org/mailman/listinfo/python-list


Single-stepping through a python script

2007-07-17 Thread Craig Howard
Hello All:

Is is possible to compile a code object and single-step through its  
execution?

Craig
-- 
http://mail.python.org/mailman/listinfo/python-list


Single-stepping through a python script

2007-07-17 Thread Craig Howard
 Craig Howard schrieb:
  Hello All:
 
  Is is possible to compile a code object and single-step through its
  execution?

 import pdb; pdb.set_trace()
 
 Look up the pdb module documentation.
 
 Diez

Sorry, I didn't give enough detail. Is it possible to single-step  
through a
code object without using pdb? (Pdb uses the console which is not  
what I want.)

Craig


-- 
http://mail.python.org/mailman/listinfo/python-list