1

I'm running a program that prompts a user to select a file from explorer and it will use that file path later in the program, but when I run it, it causes python to crash.

    from time import sleep
    from Tkinter import Tk
    from tkFileDialog import askopenfilename, askdirectory
    root = Tk()
    print "************************************************"
    print "************************************************"
    print "*****************Zip-to-PDF*********************"
    print "************************************************"
    print "************************************************"
    print""
    print "Please select your zip file: "
    sleep(1)
    root.withdraw()
    filepath = askopenfilename()

When I select a ".zip" file, the python crashes. All of the other file extensions that I have tried worked perfectly fine, but I need to be able to take in a zip file.

Is there a way to get this to work, or is there a better approach?

user2339652
  • 19
  • 1
  • 4
  • 1
    are you sure python breaks in this part of the code? what happens if you just `print filepath` after `filepath = askopenfilename()` and then `quit()` ? – behzad.nouri May 01 '13 at 14:26
  • Running from the commandline, as soon as I select the ".zip" file, an error message from windows comes up saying "python.exe has stopped working" So with those two lines added, it still doesn't reach them due to the error happening before that. – user2339652 May 01 '13 at 14:31
  • It doesn't crash on my Mac, so it must be a Windows-only thing. Have you found a solution yet? – Justin S Barrett Jun 07 '13 at 15:21
  • Doesn't crash on Windows Vista (py 2.7)... – JamJar00 Dec 17 '13 at 20:54
  • Is this your actual,j complete program? You aren't calling mainloop(), which might explain part of the problem. – Bryan Oakley Dec 17 '13 at 21:23

0 Answers0