Max Erickson wrote:
> Andrew Robert <[EMAIL PROTECTED]> wrote in
> news:[EMAIL PROTECTED]: 
> 

<snip>

<\snip>
> Check parser.usage, it is likely to look a lot like your infile.
> 
> I'm not sure, but I think you need to pass your alternative arguments 
> to parser.parse_args.
> 
> max
> 
Hi Max,

I tried passing in the read line like so:

infile= open(sys.argv[1],"rb").read()
parser=OptionParser()
print infile
(options, args) = parser.parse_args(infile)

I end up getting the following traceback.

Traceback (most recent call last):
  File "C:\Documents and Settings\Andrew Robert\My
Documents\receiver.py", line 327, in ?
    (options, args) = parser.parse_args(infile)
  File "C:\Python24\lib\optparse.py", line 1275, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "C:\Python24\lib\optparse.py", line 1322, in _process_args
    del rargs[0]
TypeError: object doesn't support item deletion

Any ideas?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to