Re: py2exe deal with python command line inside a program
sys.executable was printed out as ''C:\\Python25\\python.exe'', how can I make this work in executable package through py2exe? Does http://www.py2exe.org/index.cgi/WhereAmI help? -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe deal with python command line inside a program
Hi, have you been able to solve this problem ?? -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe deal with python command line inside a program
In article c7243b25-906a-4bf4-b20b-251ab5b6a...@m26g2000yqb.googlegroups.com, susan_kij...@yahoo.ca wrote: I need to create a python subprogress, like this: myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE) You need to change your setup.py so that myscript.py is also an exe. -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ import antigravity -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe deal with python command line inside a program
On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: Hi, I need to create a python subprogress, like this: myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE) sys.executable was printed out as ''C:\\Python25\\python.exe'', how can I make this work in executable package through py2exe? I have to fix the following problems: -Source code shouldn't exposed in an executable program -Since python environment is not required when running an executable program, how to deal with the situation that C:\\Python25\ \python.exe is required as part of command? Thanks in advance! Hi. What does it do when you try to execute it with py2exe? Does it fail to run? What is the error? -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe deal with python command line inside a program
On Sun, Jan 24, 2010 at 3:28 AM, Jonathan Hartley tart...@tartley.com wrote: On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: Hi, I need to create a python subprogress, like this: myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE) sys.executable was printed out as ''C:\\Python25\\python.exe'', how can I make this work in executable package through py2exe? I have to fix the following problems: -Source code shouldn't exposed in an executable program -Since python environment is not required when running an executable program, how to deal with the situation that C:\\Python25\ \python.exe is required as part of command? Thanks in advance! Hi. What does it do when you try to execute it with py2exe? Does it fail to run? What is the error? The subprocess call would fail utterly since sys.executable is apparently inaccurate for py2exe-generated executables. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe deal with python command line inside a program
Hi Jonathan, Here is the traceback I got, 'test.py' is where main starts, and I replaced 'sys.executable' with string 'python': args: ['python', 'C:\\myscript.py'] Traceback (most recent call last): File test.py, line 22, in module File subprocess.pyc, line 594, in __init__ File subprocess.pyc, line 816, in _execute_child WindowsError: [Error 2] The system cannot find the file specified On Jan 24, 6:28 am, Jonathan Hartley tart...@tartley.com wrote: On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: Hi, I need to create a python subprogress, like this: myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE) sys.executable was printed out as ''C:\\Python25\\python.exe'', how can I make this work in executable package through py2exe? I have to fix the following problems: -Source code shouldn't exposed in an executable program -Since python environment is not required when running an executable program, how to deal with the situation that C:\\Python25\ \python.exe is required as part of command? Thanks in advance! Hi. What does it do when you try to execute it with py2exe? Does it fail to run? What is the error?- Hide quoted text - - Show quoted text - -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe deal with python command line inside a program
On Jan 24, 6:35 am, Chris Rebert c...@rebertia.com wrote: On Sun, Jan 24, 2010 at 3:28 AM, Jonathan Hartley tart...@tartley.com wrote: On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: Hi, I need to create a python subprogress, like this: myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE) sys.executable was printed out as ''C:\\Python25\\python.exe'', how can I make this work in executable package through py2exe? I have to fix the following problems: -Source code shouldn't exposed in an executable program -Since python environment is not required when running an executable program, how to deal with the situation that C:\\Python25\ \python.exe is required as part of command? Thanks in advance! Hi. What does it do when you try to execute it with py2exe? Does it fail to run? What is the error? Thanks for pointing that, this time I try to use 'python' as the arg, I got an error: WindowsError: [Error 2] The system cannot find the file specified Because the subprocess is looking for a source code location, and which was hard coded, any suggestion to work out the issue? The subprocess call would fail utterly since sys.executable is apparently inaccurate for py2exe-generated executables. Cheers, Chris --http://blog.rebertia.com- Hide quoted text - - Show quoted text - -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe deal with python command line inside a program
On Sun, Jan 24, 2010 at 10:25 AM, im_smialing susan_kij...@yahoo.ca wrote: On Jan 24, 6:35 am, Chris Rebert c...@rebertia.com wrote: On Sun, Jan 24, 2010 at 3:28 AM, Jonathan Hartley tart...@tartley.com wrote: On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: Hi, I need to create a python subprogress, like this: myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE) sys.executable was printed out as ''C:\\Python25\\python.exe'', how can I make this work in executable package through py2exe? I have to fix the following problems: -Source code shouldn't exposed in an executable program -Since python environment is not required when running an executable program, how to deal with the situation that C:\\Python25\ \python.exe is required as part of command? Thanks in advance! Hi. What does it do when you try to execute it with py2exe? Does it fail to run? What is the error? Thanks for pointing that, this time I try to use 'python' as the arg, I got an error: WindowsError: [Error 2] The system cannot find the file specified Because the subprocess is looking for a source code location, and which was hard coded, any suggestion to work out the issue? Famous last words, but I think it's impossible. You'd have to somehow specify the Python interpreter inside the py2exe-generated executable as the program for subprocess.Popen to run, but I sincerely doubt that can be done. I would suggest something involving os.fork(), but you're clearly on Windows, which doesn't support fork(), so that option's out. The closest thing that leaves is execfile(): http://docs.python.org/library/functions.html#execfile Or you could relax your constraints: You could require Python to be installed on the system (I think there are ways to have your program's installer run the Python installer without any user interaction), or you could give up trying to keep the source code secret (it's illegal for your users to redistribute or modify it anyway, assuming you use the right EULA, and py2exe doesn't keep your sourcecode secret anyway - http://stackoverflow.com/questions/261638/how-do-i-protect-python-code) Cheers, Chris -- http://blog.rebertia.com The subprocess call would fail utterly since sys.executable is apparently inaccurate for py2exe-generated executables. -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe deal with python command line inside a program
Thanks for taking time to help me. If I use either way, requiring python being installed, or allow source codes exposure, it seems in some degree, there's not necessarily to make the executable package any more, which is very frustrating Suppose I take the first way, python environment must be on a machine, how can I have py2exe find a specific file path, for instance as below, 2 up levels from running director, how to find myscript.py in py2exe? Since in customers' machines, C:\dev\mysricpt.py doesn't exist python environment: running directory - C:\dev\level1\level2\test.py, suprocess directory-C:\dev\mysricpt.py py2exe C:\dev\level1\level2\dist On Jan 24, 1:50 pm, Chris Rebert c...@rebertia.com wrote: On Sun, Jan 24, 2010 at 10:25 AM, im_smialing susan_kij...@yahoo.ca wrote: On Jan 24, 6:35 am, Chris Rebert c...@rebertia.com wrote: On Sun, Jan 24, 2010 at 3:28 AM, Jonathan Hartley tart...@tartley.com wrote: On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: Hi, I need to create a python subprogress, like this: myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE) sys.executable was printed out as ''C:\\Python25\\python.exe'', how can I make this work in executable package through py2exe? I have to fix the following problems: -Source code shouldn't exposed in an executable program -Since python environment is not required when running an executable program, how to deal with the situation that C:\\Python25\ \python.exe is required as part of command? Thanks in advance! Hi. What does it do when you try to execute it with py2exe? Does it fail to run? What is the error? Thanks for pointing that, this time I try to use 'python' as the arg, I got an error: WindowsError: [Error 2] The system cannot find the file specified Because the subprocess is looking for a source code location, and which was hard coded, any suggestion to work out the issue? Famous last words, but I think it's impossible. You'd have to somehow specify the Python interpreter inside the py2exe-generated executable as the program for subprocess.Popen to run, but I sincerely doubt that can be done. I would suggest something involving os.fork(), but you're clearly on Windows, which doesn't support fork(), so that option's out. The closest thing that leaves is execfile():http://docs.python.org/library/functions.html#execfile Or you could relax your constraints: You could require Python to be installed on the system (I think there are ways to have your program's installer run the Python installer without any user interaction), or you could give up trying to keep the source code secret (it's illegal for your users to redistribute or modify it anyway, assuming you use the right EULA, and py2exe doesn't keep your sourcecode secret anyway -http://stackoverflow.com/questions/261638/how-do-i-protect-python-code) Cheers, Chris --http://blog.rebertia.com The subprocess call would fail utterly since sys.executable is apparently inaccurate for py2exe-generated executables. -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe deal with python command line inside a program
On Jan 22, 2:35 pm, susan_kij...@yahoo.ca wrote: Hi, I need to create a python subprogress, like this: myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE) sys.executable was printed out as ''C:\\Python25\\python.exe'', how can I make this work in executable package through py2exe? I have to fix the following problems: -Source code shouldn't exposed in an executable program -Since python environment is not required when running an executable program, how to deal with the situation that C:\\Python25\ \python.exe is required as part of command? Thanks in advance! Anyone can help? The problem took me two days and still no solutions -- http://mail.python.org/mailman/listinfo/python-list
py2exe deal with python command line inside a program
Hi, I need to create a python subprogress, like this: myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'], env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE) sys.executable was printed out as ''C:\\Python25\\python.exe'', how can I make this work in executable package through py2exe? I have to fix the following problems: -Source code shouldn't exposed in an executable program -Since python environment is not required when running an executable program, how to deal with the situation that C:\\Python25\ \python.exe is required as part of command? Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list