optparse global

ashtonn@gmail.com doodle4 at gmail.com
Mon May 16 15:56:37 EDT 2005


This does not seem to work. I still get the default value 5007 when i
run
$python txd.py - p5006
$python testme.py

***txd.py***

global options
parser = OptionParser()
parser.add_option("-p", "--port", dest="port", default=5007,
                      type="int",
                      help="port to connect to for remote interpreter")

options, args = parser.parse_args()

**testme.py**
from txd import options

print options.port

-Ashton




More information about the Python-list mailing list