problems opening files

mike mmaddox at umd.edu
Fri Feb 13 20:28:09 CET 2009


I have aprogram that manipulates several text files, does some math
and saves new files then exits.

The program worked fine on the original set of data, but with new data
does not open the files as needed.  When I copy and paste the 'open
line' from the module to IDLE the file opens.

section of code that is not working and import statements below:

import statements------------

# combine point source data

from numpy import *
from string import *
import point_input

section of code-----------------

pathincbp=path+'/sub'+sub+'/cbp_'+npdes+'.txt'
    flag='false'
    while flag=='false':
        try:
            cbpin=open(pathincbp,'r')
            flag='true'

stopping the module manually------------------------------

Traceback (most recent call last):
  File "C:\Python25\point_sources\combine_point_sources_swat.py", line
155, in <module>
    print pathincbp+' not found'
KeyboardInterrupt

IDLE commands---------------------------

>>> cbpin=open(pathincbp,'r')
>>> cbpin
<open file 'c:/potomac_points_data/sub1/cbp_PA0026051.txt', mode 'r'
at 0x01450380>

I am running in windows xp professional 2002 service pack 3 on a Xeon
dell

Thanks,
Mike





More information about the Python-list mailing list