problems opening files

M

mike

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---------------------------
<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
 
M

MRAB

mike said:
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---------------------------

<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
What exception is the open() raising? From the partial code you've
provided I can't tell whether the 'try' is catching any exception. The
traceback just tells me that you interrupted the script, not what "is
not working" actually means.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top