1

I have made a sample GUI using Python 2.7 and tkinter.., converted .py to .exe through py2exe, now if i link only the .exe file on my website for download , after downloading the exe file doesn't open since it needs dll and other files to execute, so how do I link the entire folder containing dll and other files to the href tag so that whenever user clicks on download the entire folder gets downloaded...

Edit: Found a solution (thanks to the guys below in comments)
So i used pyinstaller and executed the file in command line using the command :
pyinstaller -w -F Filename
so this command bundles all the dll and other files into a single exe ;)
also in order to include images in the exe, i added this in the main script :

def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
    # PyInstaller creates a temp folder and stores path in _MEIPASS
    base_path = sys._MEIPASS
except Exception:
    base_path = os.path.abspath(".")

return os.path.join(base_path, relative_path)

and also made changes in the spec file

  • zip it and provide the .zip file to download, or use the single file option to make an .exe that includes the other files. – Novel Mar 05 '17 at 05:54
  • @Jonathan how do i make an exe that includes the other files? because a single file would be much more appropriate –  Mar 05 '17 at 05:57
  • I've never used py2exe myself, but some quick googling [found this](http://stackoverflow.com/a/113014/2229945). I've used pyinstaller with the `--onefile` option and that works ok. The problem will all of these is that the file unzipping will be added to the program boot time. You may be much better using an normal installer (no .exe conversion) like [pynsist](https://pynsist.readthedocs.io/en/latest/). – Novel Mar 05 '17 at 06:12
  • You can also create an executable zip file, which extracts and runs the application. But try the method @Jonathan adviced first. – Prajwal Mar 05 '17 at 06:15

0 Answers0