Abh,

Despite the fact that the documentation is light on documentation deface is 
actually usable as a python package as well as as a command line tool. If you 
look at the code in your_python_installation\ 
lib\site-packages\deface\deface.py or at 
https://github.com/ORB-HD/deface/blob/master/deface/deface.py and especially at 
how the main function works then you should be able to duplicate mains 
functionality but with the values coming from your GUI rather than from the 
call to parse_cli_args you should be able to avoid the call to subprocess.Popen 
(note that such calls, especially with shell=True are considered a security 
risk).

Once you have done that you should be able to use pyinstaller without any 
problems.

Hope that helps,

Steve

From: [email protected] <[email protected]> On Behalf Of 
Abh Hom
Sent: 04 November 2024 15:38
To: PyInstaller <[email protected]>
Subject: [PyInstaller] Package not recognized or installed from pyinstaller

I'm trying to create a UI for the deface package 
(https://pypi.org/project/deface/) in python using Tkinter as the basic UI 
elements. When I run the exe on my own computer which has all the packages 
installed (deface and ttkbootstrap) the program runs fine.

But whenever I run this same exe on a separate machine that does not have 
deface package manually installed, the program sends me an error saying 
'deface' is not a recognized command.

For context, the deface package in python is a command line tool, so it runs 
entirely on the shell level rather than on a 'function from a script' level. Or 
at least this is my understanding.

I've tried to manually direct pyinstaller to the deface package using 
--add-data, and --CollectALL, and changing the spec file to make sure the 
'deface' package is listed there but in all these methods, the same problem 
still occurs. At each point, and with every iteration of the pyinstaller exe, 
the failure point seems to be this line:

command = ["deface", file, "-t", str(current_threshold), "-o", outputfilename]

process = subprocess.Popen(command, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE, shell=True)

First, I'm constructing the 'command' with all my required arguments for the 
'deface' package. Then I'm passing this through to the command line using 
subprocess().

The error is still 'deface' is not recognized as a command, function etc. etc.

Is there something that I'm doing wrong? Is this error occurring because I'm 
sending this variable down to the command line using this exe file which is an 
incorrect method?

Thanks to anyone who gives feedback here. My current workaround is having to 
manually install python, deface, and ttkbootstrap beforehand and then my 
program runs just fine but I wanted a nice workaround this just because my 
potential users may not have technological expertise to install python and 
deface package by themselves. I wanted to give a nice 'point and click' method 
for my program and user interface.
--
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion visit 
https://groups.google.com/d/msgid/pyinstaller/47b82f50-6a4a-4783-b594-698970b64863n%40googlegroups.com<https://groups.google.com/d/msgid/pyinstaller/47b82f50-6a4a-4783-b594-698970b64863n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/pyinstaller/GV2PR02MB86736D9E2AAB2D59CCE2B54AAA5C2%40GV2PR02MB8673.eurprd02.prod.outlook.com.

Reply via email to