Why executable throws error after cloning from Git repository? - python-3.x

I started using Git recently and I wanted to share my small project. It is a simple decimal conversion program written in Python3. I also coded the GUI using tkinter module.
I want the end-user to run the program as an executable. So I made my .py source file to an executable using pyinstaller. The executable worked perfectly.
I then created a new repository in Git and uploaded my source file and other files created by pyinstaller [build, dist, .spec]. When I tried cloning my repository. the executable throws an error saying:
What am I doing wrong here? Also, is this even the correct way of distributing an open source software?

Related

How to get the directory of the .exe for a Node.js pkg executable?

I'm compiling/building a Node.js project into an .exe using Vercel's pkg but I'm trying to find where that executable file is during the program's runtime. To clarify, I want the Node.js program to know where the .exe file it is being run from is, to confirm it is correctly installed.
Context:
I cannot guarantee where the user has the .exe stored the first time they run it, but I want it to copy itself to the AppData folder so I can setup a Windows service from it, if it's not being run from there already. This in hopes of making a self-installing program, that doesn't require me to build an installed around it.
So on it's first run, I need the location of the .exe to be able to copy where I want. I might just have not picked it up, but I can't find an answer on either the pkg documentation or on another question here.
What I've Tried: I have tried process.cwd, process.pkg, __filename, __dirname and so on, but they all lead to the wrong thing, usually the snapshot folder of files.
When it comes to the main script it's as simple as finding it:
process.argv
From the Node.js documentation
Pkg from Vercel, is not an installer, its just a packager that will package node binaries and your code in a single exe.
You can follow this tutorial that shows how to make an installer it even enables you to set a path of where you want your exe to be installed

How to properly install Ghostscript under Linux as shared library

The link on this page (https://www.ghostscript.com/download.html) for Linux x64, gets you a .tgz with an executable binary.
However, while trying to use this binary as an .so, (after renaming it into libgs.so and putting into appropriate place) via Ghost4J, I invariably get errors as follows:
java.lang.UnsatisfiedLinkError: /tmp/jna-100923095/jna3513656669313044092.tmp: cannot dynamically load executable
Once I install the Ghostscript via apt-get install ghostscript, the same code runs fine (as it now loads an .so from /usr/lib/x86_64-linux-gnu/libgs.so.9.22)
Question: which minimal set of files should I put to some folder, so that I could link to Ghostscript dynamic library (.so) successfully, without Ghostscript being installed on the machine/container?
UPD: under Windows, this seems to be possible, the /bin folder of the installation contains both DLL and EXE files; if I put that .dll file into a win32-x86-64 folder under resources, it is being picked up by JNA (via Ghost4j) and Ghostscript instance works fine, even once I remove the "official" installation). I would like to have same behaviour (i.e. self-sufficient, self-containing JAR file) for Linux as well.
Well, I ended up building the shared object myself, using Ubuntu 18.04 installed as WSL 1 distribution, following the guidelines from here: https://www.ghostscript.com/doc/current/Make.htm#Shared_object
These were the exact commands:
./configure --without-luratech --with-system-libtiff --with-drivers=PCLXL
make so
and then, in the sobin folder, you have libgs.so, that works as expected. But sad it's not possible to download it from the official site.

How can I get access to the script of a Python package in Ubuntu?

I am using Ubuntu for a Python project and want to get access to the script of rasa_nlu.evaluate so that I can better understand it and call the function within it with the appropriate arguments.
I am using the 0.11.5 versio of rasa_nlu. I tried to go in the usr/bin/ directory but cannot seem to be able to go any further. When I try cd /python on the Ubuntu shell, I get "No such file or directory".
Alternatively, can I find the code on GitHub? (it seems that I can only find the code of the 12.0 version of rasa...).
source for rasa_nlu is hosted on GitHub: https://github.com/RasaHQ/rasa_nlu
you can clone the repo with Git, or view the evaluate.py source right from GitHub in your browser
current master branch: https://github.com/RasaHQ/rasa_nlu/blob/master/rasa_nlu/evaluate.py
11.5 version: https://github.com/RasaHQ/rasa_nlu/blob/0.11.5/rasa_nlu/evaluate.py

Why does my pyinstaller created executable require admin privileges?

I've written a Python program which I distribute using pyinstaller. I've been using the onefile option so far to create a standalone executable. That's been great up until now, but as the application has grown the startup time is getting a bit long. I'd also like users to install the application properly to make upgrading simpler.
I've been trying to create a single directory version of the app using pyinstaller's onedir option. However, the resulting .exe file that is created requires admin privileges to run, which the onefile version did not. The program itself doesn't need any such privileges so I assume this is something that pyinstaller is doing. How do I create an application that doesn't require admin privileges?
Additional info:
Python 2.6, pyinstaller v1.4
Application uses PyQt4 and pygame modules.
Trying to create executable for Windows 7.
Using -w pyinstaller option to create a windowless executable.
admin privileges could be asked in few cases:
A. if the executable name contains relevant keywords (like setup, install, update or patch)
B. the application requests it in it's manifest.
C. the .exe file name do not match the name in the manifest file.
if you create a .spec file for your application package, you can add
exe = EXE(
...
manifest=None,
...
)
and it won't ask for password, unless you rename it to setup or install.
I have recently run into this issue, and my experience in solving it was thus:
PyInstaller with --onefile option creates a manifest file in the 'executable'. This manifest file on Windows tells the OS a few things about the application it is bundled with. One of the things it specifies, is the application name/manifest file. The format of the manifest filename is appname.exe.manifest. If your program is frozen with PyInstaller, the executable name that it stores in the manifest will be the name given to the completed EXE under the /dist folder of PyInstaller. IF you rename the EXE, the manifest file packed with it is no longer matching! Therefore, create a manifest file with the same name as the final EXE filename and run PyInstaller with the --manifest option, OR don't rename the EXE that PyInstaller creates.
When you package the PyInstaller project with the custom --manifest, the renamed program no longer requests administrator elevation.

InnoSetup: "The volume for a file has been externally altered"

InnoSetup appears to be corrupting my executable when compiling the setup project.
Executing the source file works fine, but executing the file after installation produces Win32 error 1006 "The volume for a file has been externally altered".
I've tried disabling compression and setting various flags, to no avail.
Has anyone experienced this?
UPDATE
Okay there's been some twists to the situation:
At the moment, I can even manually copy a working file to the location it is installed to and get "The volume for a file...". To be clear: I uninstall the application, create the same folder and paste the files there and run.
UPDATE 2
Some more details for those that want it:
The InnoSetup script is compiled by FinalBuilder using output from msbuild, also executed by FinalBuilder, running on my machine with XP SP3. The executable is a C# .Net assembly compiled in configuration Release|AnyCPU. The file works when executed in the folder the Install Script takes it from. It produces the same behaviour on an XP Virtual Machine. The MD5 hashes of the source file and the installed file are the same.
Ok, I just received this same error. I have a config which my executable uses. I looked in my folder a million times - but finally notice the config file was zero length. I corrected the config and the error stopped occurring.
Check the simplest things first... good lucK!
ERROR_FILE_INVALID
1006 (0x3EE): The volume for a file has been externally altered so that the opened file is no longer valid.
I suspect you're having this issue after moving the files to a network share. It seems to me that what's happening is you have an open file-handle - possibly to a temporary file you are creating - and then some other process (perhaps running on a different host) is coming along and renaming or deleting that file or its' parent directory tree.
So my advice is:
Try installing to a local directory
Run after an anti-virus scan, in
safe-mode or on a different machine
to see if there isn't some
background nasty changing
volume/directory properties while
your program is running.
Make sure the program itself isn't doing anything weird with the volume or directory tree you're working with.
Never seen that before. I've got a few questions and suggestions:
- Are you signing the EXE during the compile of the setup? If so, try leaving that part out.
- WHat OS are you installing on or does it happen on all machines you've tried?
- Run the install with the /LOG="c:\install.log" option and post the log. It might show something happening during install.
- Run a byte compare or MD5 check on the source EXE and the installed EXE. Are they the same? Do they have the same version resource?

Resources