0

I'm working on a Programm where the User can insert data via a tkinter GUI, than they are saved in a JSON and after this uploaded to a server via sftp. When i start the file in pycharm all worked as designed.

But when i try it via doubleclick on the .py file, only the command line opens for a second, but not the GUI. I did some testing and found out, that this only happened, when i import pysftp.

Here the simple program i used for testing, which worked fine:

from tkinter import *
root = Tk()
mainframe = Frame(root)
mainframe.pack()
mainframe.grid()
root.mainloop()

But if i do this:

from tkinter import *
import pysftp
root = Tk()
mainframe = Frame(root)
mainframe.pack()
mainframe.grid()
root.mainloop()

than the above mentioned happened. I use Python 3.6 and the latest pysftp version.

Have anyone an Idea why this is happening? Thanks

DavidA
  • 1
  • 2
  • Are you working with windows or linux, in linux you should start from the command line. In windows you can change the extention to .pyw: https://stackoverflow.com/questions/34739315/pyw-files-in-python-program – Arjen Dijkstra Dec 01 '17 at 08:27
  • I'm working on Windows. And when i use a .pyw file nothing at all happened – DavidA Dec 01 '17 at 08:35
  • 1
    run command line and then run code inside and you will see error message which stops program. And then put full error message (Traceback) in question (as text, not screenshot) – furas Dec 01 '17 at 09:40

1 Answers1

-2

You need to package your application using cx_freeze or py2exe. I would recommend py2exe.

Make an executable and then try double clicking on it.

waqasgard
  • 801
  • 7
  • 25