the call command:

subprocess.call(args, *, stdin=None, stdout=None, stderr=None, shell=False,
cwd=None, timeout=None, **other_popen_kwargs)

I do not understand the intricacies of subprocess, and even less so the
Windows security model -- but I'd give a try to setting:

 shell=True

I *think* that will get it closer too what os.system() does.

Then look at popen, and see if any of the "other_popen_kwargs" might help.

(I do note that many of the Popen parameters are apparently "posix only" so
???

(https://docs.python.org/3/library/subprocess.html#module-subprocess)

If that doesn't work, take a look at the subprocess docs, there are notes
in there about replacing os.system.

-CHB


On Wed, Mar 26, 2025 at 8:25 AM João Luis Valle <[email protected]>
wrote:

> Thank you a lot!
>
> Em qua., 26 de mar. de 2025, 10:55, Ulli Horlacher <
> [email protected]> escreveu:
>
>>
>> I have a program which calls Windows CLI commands via subprocess.call():
>>
>> import subprocess
>>
>> def syscall(*cmd):
>>   cmd = ['cmd','/d','/c']+list(cmd)
>>   subprocess.call(cmd)
>>
>> When I compile it with pyinstaller and start the executable via
>> desktop-click, it throws an exception:
>>
>> Traceback (most recent call last):
>>   File "\\VBOXSRV\python\W10\fexit_20250325_1641.py", line 3468, in
>> <module> wexit(main())
>>   File "\\VBOXSRV\python\W10\fexit_20250325_1641.py", line 281, in main
>> menu()
>>   File "\\VBOXSRV\python\W10\fexit_20250325_1641.py", line 376, in menu
>> cls()
>>   File "\\VBOXSRV\python\W10\fexit_20250325_1641.py", line 3366, in cls
>>     syscall('cls')
>>   File "\\VBOXSRV\python\W10\fexit_20250325_1641.py", line 3373, in
>> syscall
>>     subprocess.call(cmd)
>>   File "subprocess.py", line 345, in call
>>   File "subprocess.py", line 966, in __init__
>>   File "subprocess.py", line 1435, in _execute_child
>> OSError: [WinError 740] The requested operation requires elevation
>>
>> Why/which "elevation"?
>>
>> There is no such error when I run this programm from a cmd.exe or
>> cygwin/bash window.
>>
>> There is also no error when I I replace subprocess.call() with os.system()
>> but then I have to use a simple string as argument and cannot use a list
>> of
>> strings.
>>
>> I am using Windows 10 with:
>> Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929
>> 64 bit (AMD64)] on win32
>>
>> --
>> Ullrich Horlacher              Server und Virtualisierung
>> Rechenzentrum TIK
>> Universitaet Stuttgart         E-Mail: [email protected]
>> Allmandring 30a
>> <https://www.google.com/maps/search/Allmandring+30a?entry=gmail&source=g>
>>               Tel:    ++49-711-68565868
>> 70569 Stuttgart (Germany)      WWW:    https://www.tik.uni-stuttgart.de/
>> REF:<[email protected]>
>>
>> --
>> 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/20250325173136.GA433434%40tik.uni-stuttgart.de
>> .
>>
> --
> 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/CAEjZcf0osCbPn9ULK%2BRfFiczcVodzTF4KP3d04xj%3D_SCQj2jXw%40mail.gmail.com
> <https://groups.google.com/d/msgid/pyinstaller/CAEjZcf0osCbPn9ULK%2BRfFiczcVodzTF4KP3d04xj%3D_SCQj2jXw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]

-- 
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/CALGmxEJwA3hJrNTw7oa%3DGiaCOjQS65oPJr1rdCVs%3DC_aGHJErw%40mail.gmail.com.

Reply via email to