[Tutor] Tkinter and apache

helena bhaska helena_b2001 at yahoo.com
Thu Feb 12 20:05:50 EST 2004


Hi everybody,
I am trying to do something which might be really
stupid and impossible, but maybe I just don't know
enough.
I am trying to get a file dialog window to open from a
cgi script.
Here a piece of code that attempts to do that:
def openFile():   
    title=''
    argInitialFile=''
    root = Tk()
    root.withdraw()
    f = tkFileDialog.askopenfilename(
        parent=root,title=title,
        initialfile=argInitialFile)
    if f == "": return None
    return f
it works fine if I open it from command line, but if I
call it from the cgi script here's what I get:
Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File
"/usr/local/lib/python2.3/site-packages/mod_python/apache.py",
line 332, in HandlerDispatch
    result = object(req)

  File
"/usr/local/lib/python2.3/site-packages/mod_python/publisher.py",
line 198, in handler
    result = apply(object, (), args)

  File "/usr/local/apache2/cgi-bin/display.py", line
76, in openFile
    f = helpers.openFile()

  File "/usr/local/apache2/cgi-bin/my_utils.py", line
19, in openFile
    root = Tk()

  File "/usr/local/lib/python2.3/lib-tk/Tkinter.py",
line 1560, in __init__
    baseName = os.path.basename(sys.argv[0])

AttributeError: 'module' object has no attribute
'argv'
Any help would be greatly appreciated!
Thanks!



__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html



More information about the Tutor mailing list