Quantcast

running pyinstaller from python

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

running pyinstaller from python

Coyot Linden (Glenn Glazer)
So, we build our products from automated build scripts that are run within the TeamCity framework.  I am trying to get this to work for the first time with pyinstaller and I'm a bit mystified by the (lack of) output.

The relevant part of the build output looks like this (the number at the beginning of each line is a timestamp, print output is in bold):

1.93 build-cmd.py(129):                 print "pyinstaller exists: %s" % os.path.exists(pyinstaller_exe[0])
pyinstaller exists: True
1.93 build-cmd.py(130):                 print "target exists: %s" % os.path.exists(target[0])
target exists: True
1.93 build-cmd.py(131):                 print "about to call %s " % (pyinstaller_exe + args + target)
about to call ['C:\\Python27\\Scripts\\pyinstaller.exe', '-y', '-w', '--clean', '--onefile', '--log-level ', 'DEBUG', '-p ', 'C:\\cygwin64\\home\\coyot\\hg\\viewer\\vmp-standalone\\stage\\VMP', '--distpath ', 'C:\\cygwin64\\home\\coyot\\hg\\viewer\\vmp-standalone\\stage\\VMP', 'C:\\cygwin64\\home\\coyot\\hg\\viewer\\vmp-standalone\\stage\\VMP\\apply_update.py']
1.93 build-cmd.py(132):                 subprocess.check_call(pyinstaller_exe + args + target)
2.33 build-cmd.py(133):             except Exception as e:
2.33 build-cmd.py(134):                 print "Pyinstaller failed"
Pyinstaller failed
2.33 build-cmd.py(135):                 print repr(e)
CalledProcessError()
2.33 build-cmd.py(136):                 try:
2.33 build-cmd.py(137):                     print "returncode: %s" % e.returncode
returncode: 2
2.33 build-cmd.py(138):                     print "command: %s" % e.cmd
command: ['C:\\Python27\\Scripts\\pyinstaller.exe', '-y', '-w', '--clean', '--onefile', '--log-level ', 'DEBUG', '-p ', 'C:\\cygwin64\\home\\coyot\\hg\\viewer\\vmp-standalone\\stage\\VMP', '--distpath ', 'C:\\cygwin64\\home\\coyot\\hg\\viewer\\vmp-standalone\\stage\\VMP', 'C:\\cygwin64\\home\\coyot\\hg\\viewer\\vmp-standalone\\stage\\VMP\\apply_update.py']
2.33 build-cmd.py(139):                     print "output: %s" % e.output
output: None
2.33 build-cmd.py(142):                 sys.exit(1)


Which as you can see has no output.  Running the equivalent command by hand works just fine:

C:\\Python27\\Scripts\\pyinstaller.exe -y -w --clean --onefile --log-level DEBUG -p C:\\cygwin64\\home\\coyot\\hg\\viewer\\vmp-standalone\\stage\\VMP --distpath C:\\cygwin64\\home\\coyot\\hg\\viewer\\vmp-standalone\\stage\\VMP C:\\cygwin64\\home\\coyot\\hg\\viewer\\vmp-standalone\\stage\\VMP\\apply_update.py

which has lots of nice output ending with:

9115 INFO: Appending archive to EXE C:\\cygwin64\\home\\coyot\\hg\\viewer\\vmp-standalone\\stage\\VMP\apply_update.exe

and indeed the file exists:

01/31/2017  11:59 AM         6,785,597 apply_update.exe

So my questions two are:

1) Any idea on how to coax more information into CalledProcessError to see what is going on?
2) More directly, what is failing here?

Thanks in advance,

coyot

GLENN GLAZER | Senior Software Engineer
m:
562.305.2920 | email:  [hidden email] | Second Life: Coyot Linden
LINDEN LAB | Create Virtual Experiences

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: running pyinstaller from python

Hartmut Goebel
Am 31.01.2017 um 21:24 schrieb Coyot Linden (Glenn Glazer):
So my questions two are:

1) Any idea on how to coax more information into CalledProcessError to see what is going on?

a) When trying to reproduce this in an interacrive console, I get output at stdout (or stderr, I did not verify). Maybe your framework is catching this?
b) If you lokk at the code of check_call, you can see that not output is passed to CallProcessError.
c) Try another function in subprocess to fetch the output of the process.

2) More directly, what is failing here?

You are passing options with trailing spaces, e.g. "--log-level " and "-p ".

BTW: If your build-com.py is known to always use the same Python version as PyInstaller, you may use

PyInstaller.__main__.run(["-y", "-w", …])

--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
Information Security Management, Security Governance, Secure Software Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Blog: http://www.goebel-consult.de/blog/warum-sie-nicht-perl-programmiern-sollten
Kolumne: http://www.cissp-gefluester.de/2010-06-adobe-und-der-maiszunsler

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: running pyinstaller from python

Coyot Linden (Glenn Glazer)
On 1/31/17 13:50, Hartmut Goebel wrote:
Am 31.01.2017 um 21:24 schrieb Coyot Linden (Glenn Glazer):
So my questions two are:

1) Any idea on how to coax more information into CalledProcessError to see what is going on?

a) When trying to reproduce this in an interacrive console, I get output at stdout (or stderr, I did not verify). Maybe your framework is catching this?

Possibly, I will need to dig.

b) If you lokk at the code of check_call, you can see that not output is passed to CallProcessError.

The docs also say this, though it is kind of buried.  The distinction between _call and _output is buried in the definition of the error, not the methods.

c) Try another function in subprocess to fetch the output of the process.

Yup.  Tried an "dir Q:" and got None because it was _call.  I've converted instances of using _call to _output.


2) More directly, what is failing here?

You are passing options with trailing spaces, e.g. "--log-level " and "-p ".

Ah ha!  Sharp eyes, my friend. 

BTW: If your build-com.py is known to always use the same Python version as PyInstaller, you may use

PyInstaller.__main__.run(["-y", "-w", …])


Even better!  That's not only more pythonic, but also faster in that I am not forcing python to shell out.

Thanks much!

coyot

GLENN GLAZER | Senior Software Engineer
m:
562.305.2920 | email:  [hidden email] | Second Life: Coyot Linden
LINDEN LAB | Create Virtual Experiences

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.
Loading...