PyInstaller file producing error after sent - python

I have created a PyInstaller file that runs perfectly on my computer. This file contains version 3.7.7 of python, selenium module, requests module, random module, and time module. However, when I attempt to send it to another computer that has the same OS. it produces this error:
[1174] Error loading Python lib '/var/folders/lc/sp95n3k172l7wnj34b9fqg9m0000gn/T/_MEINZTtRX/Python': dlopen: dlopen(/var/folders/lc/sp95n3k172l7wnj34b9fqg9m0000gn/T/_MEINZTtRX/Python, 10): Symbol not found: _futimens
Referenced from: /var/folders/lc/sp95n3k172l7wnj34b9fqg9m0000gn/T/_MEINZTtRX/Python
Expected in: /usr/lib/libSystem.B.dylib
in /var/folders/lc/sp95n3k172l7wnj34b9fqg9m0000gn/T/_MEINZTtRX/Python
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
It appears that the error is happening because it cannot find a python file. My goal is to run this on a computer with the same OS without python installed. Is there a way to do this?

Yes there is a software that converts the whole project into an .exe file that can run on any Windows machine.
Download NSIS
There's tonnes of tutorials on how you can proceed from here, I can't explain the whole thing.
Hope this is what you're looking for.

Related

Use C++ dll in pycharm

I’m writing some python code for which I need to access a c++ dll(.so file)
I’m working on pycharm and I’ve already added the library path to my project by following these steps: (settings>project interpreter>Add new interpreter path)
when i run the code
self._bridgeLink = cdll.LoadLibrary(‘foo.so’)
Or
self._bridgeLink = cdll.LoadLibrary(‘./foo.so’)
It gives me an error saying
OSError: foo.so : cannot open shared object file: No such file or directory
The error you are posting suggests that your .so file is not next to your working directory. Try an absolute path to the .so file for testing for now.
You should also check which compiler was used to compile python, you should use the same major version is the Compiler (there are some exception, but that's not the problem for now)

Fatal Python error when trying to run an executable Python script

I have a Python script that I have turned into an executable using cx-freeze-4.3.4.win32-py3.4. I have Python 3.4 installed on a Windows 7 64-bit machine.
Here is my simple setup.py file:
from cx_Freeze import setup, Executable
setup( name = "myfilename" ,
version = "0.1" ,
description = "This is my file" ,
executables = [Executable("myfilename.py")] , )
I ran python setup.py build from command prompt in the C:\Python34 folder with both the script I was trying to convert and the setup.py file.
This created another folder called build within was another folder called exe.win32-3.4. In that folder I found my executable file, a bunch of .pyd files, a single .dll file, and a zipped archive called library of a bunch of .pyc files.
If I run the executable from within the exe.win32-3.4 with the library zip archive it executes fine. However, without the library archive of .pyc files (basically if I try just to run the .exe by itself, which is what I am supposed to be able to do) the executable throws out this error:
Fatal Python error: cannot get zipimpirter instance
Current thread 0x000001b48 (most recet call first):
I did some preliminary searching around the web for potential resolutions to the issue but could not find anything substantial. If anyone knows how to troubleshoot this issue that would be much appreciated.
From the docs:
Single-file executables
cx_Freeze does not support building a single file exe, where all of the libraries for your application are embedded in one executable file.
For a single-file solution using py2exe and others, see this question.
In 3.5 there is also the new zipapp module, although the basic functionality has been around for a while.

Application Loader: error when creating a .pkg file using productbuild

I am testing the command "productbuild" to archive my application bundle CEMHapp. The idea is to submit the built .pkg file to Mac App Store. At the moment, I am having the following problem:
When I try to run the basic command:
productbuild --component "CEMHapp.app" /Applications CEMHapp.pkg
I get the following error message:
productbuild: error: The component at "CEMHapp.app" is not a bundle.
I also tried the command "pkgbuild", i.e.
pkgbuild --component CEMHapp.app --version 1 --install-location /Applications CEMHapp.pkg
But the following error appears
pkgbuild: Adding component at /Users/wilsondasilva/Desktop/Aplk/CEMHapp.app
pkgbuild: error: Path "/Users/wilsondasilva/Desktop/Aplk/CEMHapp.app" is not a valid bundle component (using destination path "/Users/wilsondasilva/Desktop/Aplk")
The strange thing is that the CEMHapp.app file works runs like a charm, so I do not understand why the system gives me the above presented error. Can anybody shed light on this topic and give me some guidance?
The CEMHapp is a open-source free application that was developed using QtCreator and Python. The bundle (CEMHapp.app) was created using pyinstaller and can be downloaded at http://concrete.fsv.cvut.cz/~wilson/Software/CEMHapp_v.1.0_MacOSX_10.9.2.dmg
Best regards and thanks in advance,
W.
I guess I found a solution for one of the problems, which partially answers my question.
I changed some parts of the command pkgbuild and the CEMHapp.pkg file was successfully created.
Here is the command I used:
pkgbuild --identifier com.CEMHapp.pkg.app --install-location /Applications --root /Users/wilsondasilva/Desktop/Aplk CEMHapp.pkg
after the process is finished, the message in terminal reads
pkgbuild: Wrote package to CEMHapp.pkg
I installed the CEMHapp.pkg and it worked. Nonetheless, the .icns file that was related to the CEMHapp was somehow lost and replaced with the default icon file. Also, a copy of CEMHapp.pkg (with Zero-bytes) appeared in /Applications. Does anybody have a clue on what is wrong?
Furthermore, I still do not know how to use the productbuild properly. Like pkgbuild, it always works when I use the argument --root, but the same is not true when using --component, see error message below:
pkgbuild --identifier com.CEMHapp.pkg.app --install-location /Applications --component /Users/wilsondasilva/Desktop/Aplk CEMHapp.pkg
pkgbuild: Adding component at /Users/wilsondasilva/Desktop/Aplk
pkgbuild: error: Path "/Users/wilsondasilva/Desktop/Aplk" is not a valid bundle component (using destination path "/Users/wilsondasilva/Desktop")
Remember that according to Mac Developer's Library,
"When creating product archives for submission to the Mac App Store, use only the --component mode of productbuild. The other modes will create product archives that are compatible with the OS X Installer, but are not necessarily acceptable for the Mac App Store."
Cheers,
W.

PySNMP Error: pysnmp.smi.error.SmiError

I am running a Python program on a Windows XP machine. When I run the program, I get the following error:
File "C:\Python27\lib\pysnmp\smi\builder.pyt, line 230, in loadModules...
pysnmp.smi.error.SmiError: MIB file "SNMPv2-MIB.py[co]" not found in search path
The file SNMPv2-MIB.py is currently located in C:\Python27\Lib\pysnmp\smi\mibs. Does anyone know how I can solve this?
if a mib is missing make sure you have performed a pip install pysnmp-mibs first if you used pip install pysnmp.
I just ran into the same issue. I filed a bug for it and included a patch:
https://sourceforge.net/tracker/?func=detail&aid=3204704&group_id=14735&atid=114735
As Sivakumar says, the reason it's failing is because pysnmp is looking for MIBs with a .pyc or .pyw extension. pysnmp gets these extensions from imp.get_suffixes(). Based on the way pysnmp deals with the extensions returned from this function, the .pyw entry will overwrite the .py entry. The fix I proposed will simply ignore the .pyw extension.
If you install the library from the .egg it should work fine because the .egg includes compiled (pyc) MIBs.
You are not able to load the MIB file.
Can you check :
>>> print builder.MibBuilder().getMibPath()
Usually this should be ok as the mib instances should be in
pysnmp/smi/mibs/instances
Code where error is raised in builder.py
if not self.__modSeen.has_key(modName):
raise error.SmiError(
'MIB file \"%s\" not found in search path' % (modName and modName + ".py[co]")
)
Usually this should get solved by calling setMibPath on the mibBuilder instance before calling loadModules.
Since the path you are getting
C:\Python27\lib\pysnmp\smi\mibs\instances,
C:\Python27\lib\pysnmp\smi\mibs,
C:\Python27\lib\pysnmp_mibs
Why don't you move the file to one of these directories?
The place where it is currently located
C:\Python27\Lib\pysnmp\smi\mibs
is not among the paths that you got via builder.MibBuilder().getMibPath()
I ran into the same issue (with pysnmp-4.2.5). I generated my own MIB python file using:
build-pysnmp-mib -o IF-MIB.py /usr/share/mibs/ietf/IF-MIB
on RHEL6 (build-pysnmp-mib does not work on RHEL5 as it requires libsmi version > 0.4.5 and RHEL5 just has this version while RHEL6 has 0.4.8).
Then I copied the generated file IF-MIB.py into the directory where the other python MIB files of pysnmp are located, (/.../site-packages/pysnmp/smi/mibs/)
Today i too face this same issue. The mibs path is correctly set. While running the pysnmp in debugging mode, i am able to found that it is expecting a SNMPv2-MIB.pyc or .pyw file.
Since i have unzipped the pysnmp from source and using it, the corresponding pyc file for the mib module is not available in that folder structure. I havent tried compiling the corresponding .py files available in the pysnmp-4.1.13a\pysnmp\smi\mibs\instances or pysnmp-4.1.13a\pysnmp\smi\mibs, instead i used the easyinstall script to download the pysnmp module.
With the egg file, now the issue is not coming.
Thanks
Sivakumar

Pyinstaller ld-linux-x86-64.so.2 linking problem

I'm trying to deploy my Python based application on another Linux host. Pyinstaller works flawlessly as long as I run the generated executable on my own system.
On the target box I get this error message:
/lib/ld-linux-x86-64.so.2: bad ELF
interpreter: No such file or directory
As the output of ldd shows Pyinstaller links my application against /lib/ld-linux-x86-64.so.2 which is only available at /lib64/ld-linux-x86-64.so.2 on the target system (where I only have basic user privileges, so symlinking the file is not an option).
How can I modify my executable to look for the library in /lib64/ instead of /lib/ ?
This is not really a Python question, but a UNIX/Linux compile and link question.
First of all, are you using the latest Pyinstaller. If not, then try that. If you still have the problem, then please report the bug to the Pyinstaller developers here.
Try to workaround your problem by using LD_LIBRARY_PATH to point to the correct directory. For more info read this article

Categories

Resources