py2exe setup script work only if placed under the same path of the target script - freeze

I created the setup.py script to create the exe (where the freeze or setup functions are called with a target script 'target.py'), then I invoke the script as 'python setup.py py2exe'.
However I discovered that the executable is created fine as far as this setup.py script is in the same location of the target.py script. If The two script are not in the same location the created executable does not work because not all parts of the code are included.
I am missing something about a rule of setup.py and target.py script ?
I have verified I am passing correctly the target.py location to the setup.py.
Important, the exe creation does not fail or whatever, simply the created exe is not functional since it is missing something.
Moreover I have an old code (py2exe in py2.7) where the setup and target scripts are not in the smae location and it works.
I expected that the relative position of the target.py script with respect to the setup.py script should not influence the outcome (exe). What I acutally get is a different result.
I have an old code where the two scripts are not in under the same path and it works (with an old py2exe and py2.7)
The documentation is not explicitly mentioning something about this.

Related

PyInstaller Executable File: ModuleNotFoundError - Pandas

Background: I have a .py script which uses c.10 libraries/dependencies (e.g., pandas numpy json) and the script also relies on a .ini file, which it looks for in the same dir as it is located.I want to add this .py file to Windows Scheduler, but before I can, I must make the file executable.
Issue: I used PyInstaller to create an executable file. I also added -- onefile and -w when creating the .exe file. My issue is that when I attempt to run the main.exe (either by double-clicking or through cmd) I get the following Unhandled exception in script -
Help: I am trying to understand how this is happening, especially as my understanding of PyInstaller is that it would create an executable file, which would inc. everything the script needs to run (Note: I have double checked that the .py contains import pandas etc.
Can someone explain to me how I would troubleshoot this and/or if there are any key steps I may have obviously missed, which might be causing this?
Try using this commandline for compiling your python file, pyinstaller.exe --onefile --noconsole --hidden-import pandas {Your_FILE_NAME}.py

one file fails to execute pyinstaller

I have been using pyisnataller to create executable applications of my python 3.6.5 scripts. The scripts are GUI interfaces. I have used a recipe from a previous stackoverflow post: link
It has been effective but am running into a slight snafu trying one file a simple GUI.
Why does the executable fail to run? The temporary folder created has the two files added within about.spec?
Any help would be appreciated!
I would have placed the code, and the spec file here but stackoverflow didnt seem to perform the formatting well enough to send the message. I tried backticks four spaces, a missing line followed by eight space, and
Yes, this is an ill posed question. So, turns out the pyinstaller creates a warn_yourscript_.txt file and the post warnings in the creation of the executable. The file is located in the working directory/build/yourscript/warn_yourscript_.txt. Having looked into the file, there was a warning about not being able to load or missing the TKinter module. The myscript.py was running smoothly under python 3.6.5, but I may have started my script from a starter on the internet and may have been from an earlier python. I have several pythons loaded on my machine, python could find it but pyinstaller could not? I changed out myscript to reflect earlier success with tkinter instead.

Pyinstaller executable cannot find QtWebEngineProcess.exe

I'm trying to compile a python program using Pyinstaller that will run PyQt5 QtWebEngineWidgets. Unfortunately there seems to be an issue with the relative path to QtWebEngineProcess.exe within the pyinstaller build.
I installed pyqt5 to be used with Python 2.7 following this method:
https://www.riverbankcomputing.com/pipermail/pyqt/2016-December/038450.html
When I compile this the executable runs fine on my machine but if I move the executable to a computer that does not have Qt installed then it gives me the error 'Could not find QtWebEngineProcess.exe'
Within the dist folder of the pyinstaller build there is a 'PyQt5/Qt/bin' directory that contains QtWebEngineProcess.exe. However I'm not entirely sure why it's not linking to this and still linking to the one in C:\Qt.
I'm certain it's still using the QtWebEngineProcess.exe installed at C:\Qt because if I change that directory name, the built program will fail on the machine I built it on.
At this point I'm trying to edit the paths within the qt.conf file contained in the bin file within the pyinstaller dist directory but I'm not entirely certain that's the answer to this. Ultimately I want a single file executable and by that point I can't edit the contents of the executable.
Thanks!
-Mark

Windows Form VB.Net - Attaching empty Directories for Deployment

I'm creating a GUI in order to launch a batch file which then kicks off a Powershell script. The GUI compiles fine and everything works great, however when I go to deploy the file it doesn't actually include any of the empty directories my script relies on.
How can I add empty directories to be included in my published VB form during install?
I don't think you can. Why don't you just do
If Not Directory.Exists(dir) Then
Directory.Create(dir)
End If
for each directory? I would create a list of directories over which to enumerate and run this each time the application is run.
You can always use the post build step to either create the directories you need or do other logic that your program may need such as run a batch file or power-shell script
See the example below. It will create a directory Test in the output directory where the .exe is placed.

Using SSIS package to zip all the txt files and move to related folder [duplicate]

I am trying to zip the contents of a Folder in SSIS, there are files and folders in the source folder and I need to zip them all individually. I can get the files to zip fine my problem is the folders.
I have to use 7.zip to create the zipped packages.
Can anyone point me to a good tutorial. I haven't been able to implement any of the samples that I have found.
Thanks
This is how I have configured it.
Its easy to configure but the trick is in constructing the Arguments. Though you see the Arguments as static in the screenshot, its actually coming from a variable and that variable is set in the Arguments expression of Execute Process Task.
I presume you will have this Execute Process task in a For Each File Ennumerator with Traverse SubFolders checked.
Once you have this basic setup in place, all you need to do is work on building the arguments to do the zipping, how you want them. A good place to find all the command line arguments is here.
Finally, the only issue I ran into was not providing a working directory in the command line arguments for 7zip. The package used to run fine on my dev environment but used to fail when running on the server via a SQL job. This was because 7zip didn't have access to the 'Temp' folder on the SQL Server, which it uses by default as the 'working directory'. I got round this problem by specifying the 'working directory as follows at the end of the command line arguments, using the -ws switch:
For e.g:
a -t7z DestinationFile.7z SourceFile -wS:YourTempDirectoryToWhichTheSQLAgentHasRights