How can I use pywin32 with a virtualenv without having to include the host environment’s site-packages folder?

I found http://old.nabble.com/Windows:-virtualenv-and-pywin32–td27658201.html (now a dead link) which offered the following solution: Browse http://sourceforge.net/projects/pywin32/files/ for the URL of the exe you want Activate your virtualenv Run easy_install http://PATH.TO/EXE/DOWNLOAD This works with modern versions of setuptools (circa February 2014, reported by tovmeod in the comments). If you are using an old version of setuptools (or distribute … Read more

Windows- Pyinstaller Error “failed to execute script ” When App Clicked

Well I guess I have found the solution for my own question, here is how I did it: Eventhough I was being able to successfully run the program using normal python command as well as successfully run pyinstaller and be able to execute the app “new_app.exe” using the command line mentioned in the question which … Read more

Get all modules/packages used by a python project

You can give a try to the library https://github.com/bndr/pipreqs found following the guide https://www.fullstackpython.com/application-dependencies.html The library pipreqs is pip installable and automatically generates the file requirements.txt. It contains all the imports libraries with versions you are using in the virtualenv or in the python correctly installed. Just type: pip install pipreqs pipreqs /home/project/location It will … Read more

Determining application path in a Python EXE generated by pyInstaller

I found a solution. You need to check if the application is running as a script or as a frozen exe: import os import sys config_name=”myapp.cfg” # determine if application is a script file or frozen exe if getattr(sys, ‘frozen’, False): application_path = os.path.dirname(sys.executable) elif __file__: application_path = os.path.dirname(__file__) config_path = os.path.join(application_path, config_name)

Bundling data files with PyInstaller (–onefile)

Newer versions of PyInstaller do not set the env variable anymore, so Shish’s excellent answer will not work. Now the path gets set as sys._MEIPASS: 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 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)