On Mon, May 11, 2020 at 1:16 AM Spooky Shadow <demonsl...@gmail.com> wrote:


> I have a tool organizer written in python that opens other apps using
> subprocess.
>

This is going to to come down to the details of how exactly you do that.
I'm a little fuzzy, but the subprocess module allows you to control how
things are set up before you run the command. in this case, you may be
interested in:

"""
If *env* is not None, it must be a mapping that defines the environment
variables for the new process; these are used instead of the default
behavior of inheriting the current process’ environment. It is passed
directly to Popen
<https://docs.python.org/3/library/subprocess.html#subprocess.Popen>.
"""
and maybe the "shell" parameter as well.

If you are simply using "python.exe", then it'll be up to the whatever PATH
is set to find Python.

the trick here is that you are shipping one thing, and then expecting it to
run stuff with "the system Python", but Windows does not HAVE a system
Python, so that may not exist, or be installed in a different way, etc. If
you can count on your users to have installed the cPyton installed in the
degfault way, then you can probably use a full path, somethign like:

C:\\WINDOWS\\SYSTEM32\\python27]python.exe

(not on Windows now, so not exactly sure).

However:

1) maybe you DO want the subprocesses to use your bundled Python? tHat way
you can be assured that it's bundled hwo you want it, with any required
dependencies, etc.

2) your sys.path is pretty odd -- it seems to be using the bundled python,
but it's got a bunch of system stuff on the sys.path -- THAT seems a recipe
for disaster.

HTH,
-CHB












> Those apps can execute scripts written in python. The problem is that when
> I pack organizer with PyInstaller and run it, whenever apps oppened by it
> run python scripts, they use python packed inside of organizer.
>
> Easiest example: I open cmd via organizer and write this:
>
> >pythonPython 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 
> >64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for 
> >more information.>>> import sys>>> sys.path['', 
> >'C:\\Users\\myuser\\AppData\\Local\\Temp\\_MEI156362\\python27.zip', 
> >'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 
> >'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 
> >'C:\\Python27\\lib\\site-packages', 
> >'C:\\Python27\\lib\\site-packages\\win32', 
> >'C:\\Python27\\lib\\site-packages\\win32\\lib', 
> >'C:\\Python27\\lib\\site-packages\\Pythonwin', 
> >'C:\\Python27\\lib\\site-packages\\wx-3.0-msw']
>
> If I open cmd regulary and do the same the output is like this:
>
> ['', 'C:\\WINDOWS\\SYSTEM32\\python27.zip', 'C:\\Python27\\DLLs', 
> 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 
> 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 
> 'C:\\Python27\\lib\\site-packages', 
> 'C:\\Python27\\lib\\site-packages\\win32', 
> 'C:\\Python27\\lib\\site-packages\\win32\\lib', 
> 'C:\\Python27\\lib\\site-packages\\Pythonwin', 
> 'C:\\Python27\\lib\\site-packages\\wx-3.0-msw']
>
> How can i make it use the sysytem interpreter when oppened from .exe?
>
> --
> 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 pyinstaller+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pyinstaller/d42c6742-c52e-4286-911d-9521e41aaedc%40googlegroups.com
> <https://groups.google.com/d/msgid/pyinstaller/d42c6742-c52e-4286-911d-9521e41aaedc%40googlegroups.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

chris.bar...@noaa.gov

-- 
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 pyinstaller+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/CALGmxE%2BGNOWzPBrG1oQmMc3yif%3DimAVrnQC1f3CspHEhRf8%3DMA%40mail.gmail.com.

Reply via email to