I'm unfamiliar with the terminology used for linking files into executables as they are compiled.
I want to write a Python script that extracts .icos from Windows executables that are viewable when you make file associations inside Folder Options. These are simply linked into the executable file upon compilation.
Then the script would sort the .ico files into individual folders based on their origin (it's supposed to extract all from subfolders/recursively) and even tell the difference between recently installed files and files that were left there previously.
Is there a library available that does such? Would I have to use a Python "Windows unlinker" or could I have it scan through RC resources too? Would there at least be a .DLL I can access with Python that does so?
Related
I am successfully using py2exe to produce a Windows binary distribution of several independant Python scripts (using standard Python27.dll + PyQt pyd files + Matplotlib pyd files) producing an executable for each one (app1.exe, app2.exe, ...).
Each of these executables work as expected if kept in the same directory as their dynamic dependencies (these dependencies are exactly the same)
I tried to create a common directory, say CommonDynamicLibrariesPython , which contains all these dll/pyd dependencies, then place each application in a different location and attempt to run it through a batch file after I set the path system variable locally to include the dll/pyd, using something like:
:: run_app1.bat placed in c:\dir_app1
set PYTHONDLL=my_path_to_CommonDynamicLibrariesPython
set PATH=%PYTHONDLL%;%PATH%
start /B app1.exe
Alternately I tried also changing PYTHONPATH from the batch and from the python script itself, but no luck.
Can anyone tell me why isn't this possible ?
In other words, is it possible to run a python executable produced by py2exe when placed outside its original dist folder, without using shortcuts, but using a batch file
I want to make an executable file which will extract multiple files into a specific location.
I've read about the 'extractall()' function, and using unzip, but how do I contain the multiple files inside the executable python file, so each time the user double click the exe file, it will extract these files into the hard coded location?
Be aware that your archive will be (in most part) platform-specific -- it may not work on Windows if you make it on a Unix-like machine and vice versa, etc.
I would recommend that you check this pymakeself which is a pypi https://pypi.python.org/pypi/pymakeself
In fact, you may find the following codes immediately relevant.
Self Extracting Archiver (Python recipe): http://code.activestate.com/recipes/577485-self-extracting-archiver/
Build a compressed self-extracting executable script on UNIX (Python recipe): http://code.activestate.com/recipes/497000-build-a-compressed-self-extracting-executable-scri/
I'm trying to create a simple game using C++ with Python embedding. The python code is embedded in my C++ code. I used Python/C API for this. Main programm wrote on MFC. My purpose, that programm will be run on computer, where not installed Python. For this I put these files in my .exe directory:
python27.dll
Python27\
DLLs\ (contents of DLLs folder)
Lib\ (contents of Lib folder)
But I want to put these files in my .exe. It's possible? May be I can link my programm with Python together to create single .exe Read many posts, but didn't find solution...
P.S. About py2exe and etc. I know, but it is for create .exe from "clean" Python programm.
I don't mean to compile code and interpreter as an exe as it is 99% questions there. I mean to build a static single python.exe to be able to execute any script by giving it as argument any *.py file.
I mean the same situation as it is with nodeJS when you download only single executable.
Or if it is not possible to single exe, maybe to just a few files instead of huge default package such as is with for example Sublime text where all python engine is in python33.dll and python3.3.zip all about 5mb, but there is no python exe to run code externally that is not as a plugin.
On Windows you need three files. You question lists two of them. The third is python.exe. On Windows the interpreter must be built separately from the actual executable so that C modules can access the functions within the interpreter.
The DLL must be built from the Python source so that all the C modules that come with Python can be built into it instead of being contained in the .pyd files that come with Python. The zip file is composed of all the Python modules in the standard library; see the zipimport documentation for more information about the import process.
I've made my first Python program, using Python 3.2. Now I'm trying to figure out how to make it an executable.
I pretty much only need it for Windows only. I've searched as much as possible and found out that py2exe doesn't support Python 3. cxfreeze does, but I can't figure out how to make a single executable of my program with it. I need it as a portable one-file exe.
Please bear with me as I am a total newcomer :) Any help is appreciated.
You can use cxfreeze to make the executable (and other files it creates), compress them into a *.7z archive using 7-zip, then use 7-ZIP SFX Maker to turn it into a self extracting archive.
When creating the SFX archive, configure it so that the main executable cxfreeze generates runs when the files are extracted. You can also change the archives icon, as well as tell the archive to extract and run from a temporary folder.
When the user runs the exe, the files will extract to the temporary folder and the program will run. To the user, it will behave exactly like a normal exe file.
According to the Python docs, the only program that will package Python3 as an .exe in cx_freeze, and the cx_freeze developer has explicitly stated that he will not support single-file executables (due to the 'dirty hacks' needed, which some anti-malware programs flag as malware).
Comment on the feature request to add Python3 support to py2exe.
You can compare py2exe folder structure with new python3, and make similar. Then you could use SFX idea to store these folders like libraries, python script and interpreter and set script for SFX to just launch your application. As I remember, this is possible in WinRar, and as I think now, in other archivers.