file Error

S

saif.shakeel

Hi,
I am parsing an xml file,and using raw_input command to ask the
user to enter the file name.Ex
Enter The ODX File Path:

Suppose my code does not work properly,then in the python idle window
it shows something like this:C:\Projects\ODX Import\Sample Files\MiscFiles
\CIM_A3300_diag_spec_sw49.xml
Traceback (most recent call last):
File "C:\Projects\ODX Import\code_ini\odxparse_mod_off_comm.py",
line 339, in <module>
process_variant(variant)
File "C:\Projects\ODX Import\code_ini\odxparse_mod_off_comm.py",
line 285, in process_variant
triplet = triplet + get_did_lengths(iservice,local_service_id)
File "C:\Projects\ODX Import\code_ini\odxparse_mod_off_comm.py",
line 238, in get_did_lengths
local_min = local_min + ddoref_min[ddorefstring]
KeyError: '_210'

This is some bug related to code ..thats ok..but when i run
the program immediately again for some other input..then it does not
show the prompt :Enter The ODX File Path:

but instead a blinking prompt which accepts the
filename something like this:C:\Projects\ODX Import\Sample Files\MiscFiles\Diagnostic CTS Global
Epsilon TIM V1.4.xml

I want the inputfile prompt to appear regardless of
the error condition.I dont know where the problem lies.Can someone
help me out.
Thanks
 
G

Gabriel Genellina

Hi,
I am parsing an xml file,and using raw_input command to ask the
user to enter the file name.Ex
Enter The ODX File Path:

Suppose my code does not work properly,then in the python idle window
it shows something like this:
[...traceback...]
I want the inputfile prompt to appear regardless of
the error condition.I dont know where the problem lies.Can someone
help me out.

- IDLE is a development environment - don't use it to actually run your
program in production.

- Instead of asking the user to type the file name, accept it as a
parameter, that's what almost everyone else does in the world... It has
many advantages: you can associate your program with the filename
extension, you can use the "Send to..." menu, you can run it inside a
batch file, you can drop a file over your program to be processed, etc.
 
S

saif.shakeel

Hi,
I am parsing an xml file,and using raw_input command to ask the
user to enter the file name.Ex
Enter The ODX File Path:
Suppose my code does not work properly,then in the python idle window
it shows something like this:
[...traceback...]
I want the inputfile prompt to appear regardless of
the error condition.I dont know where the problem lies.Can someone
help me out.

- IDLE is a development environment - don't use it to actually run your
program in production.

- Instead of asking the user to type the file name, accept it as a
parameter, that's what almost everyone else does in the world... It has
many advantages: you can associate your program with the filename
extension, you can use the "Send to..." menu, you can run it inside a
batch file, you can drop a file over your program to be processed, etc.

Thanks for the reply........How do i accept the filename is a
parameter and avoid the error.Can you elaborate.
 

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,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top