IOError raised when updating cache

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

IOError raised when updating cache

jelle feringa
Hi,

I'm duly impressed by PyInstaller, what an amount of work must have gone into this project, its impressive how much the program is able to resolve by default.
Its great to have a method of distributing a Python project that does not include the source code.

Today I ran into a particular error, when trying to package a project.
It seems as if PyInstaller cannot find the Python lib would be my guess.

I've attached the .spec and the script I'm trying to package, basically, a hello world of enthought traits.
I'm trying to package a pretty large CAD application and I'm trying to go about this by segmenting the issue into manageable bits.
Interestingly, I've been able to produce a 0.5+GB executable from my project ( a non-working alas ), but seem to have ran into a bug with a very small program ( "simple_traits.py" )

I've used the following commands to package:
pyi-makespec --onedir --name="SimplestTraits" --out=build --noconsole --debug simplest_traits.py
pyi-build SimplestTraits.spec

With the following traceback you find below.
Finally, its worth mentioning that I'm on osx 10.8 and use the 2.6 python interpreter.

Thanks so much for PyInstaller!

-jelle

23778 INFO: Removing dir /Users/jelleferinga/Documents/workspace/PyRAPID/Code/PyRAPID/build/dist/SimplestTraits
23797 INFO: building COLLECT out00-COLLECT.toc
Traceback (most recent call last):
  File "/usr/local/bin/pyi-build", line 9, in <module>
    load_entry_point('PyInstaller==2.1dev-0f0f4a4', 'console_scripts', 'pyi-build')()
  File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/cliutils/build.py", line 38, in run
    PyInstaller.build.main(None, args[0], opts.__dict__["buildpath"], opts.__dict__["noconfirm"])
  File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 1674, in main
    build(specfile, buildpath)
  File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 1627, in build
    execfile(spec)
  File "SimplestTraits.spec", line 24, in <module>
    name=os.path.join('dist', 'SimplestTraits'))
  File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 1218, in __init__
    self.__postinit__()
  File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 305, in __postinit__
    self.assemble()
  File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 1248, in assemble
    and config['hasUPX'], dist_nm=inm)
  File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 786, in checkCache
    digest = cacheDigest(fnm)
  File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 740, in cacheDigest
    data = open(fnm, "rb").read()
IOError: [Errno 2] No such file or directory: 'Python'

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Zak
Reply | Threaded
Open this post in threaded view
|

Re: IOError raised when updating cache

Zak
On 3/11/13 12:51 PM, jelle feringa wrote:
> Its great to have a method of distributing a Python project that does
> not include the source code.

I just want to clarify for everyone reading this: PyInstaller bundles
basically do include the Python source code for your application, the
bundle could be deconstructed to reveal the source code. PyInstaller
provides convenience, but it does not provide secrecy.

Some languages are very easy to decompile, such as Java and C#. In
theory it would be easy to decompile a PyInstaller bundle, but in
practice I suspect nobody has written a tool to do it yet.

If you want to hide your source code, then I recommend using Cython with
PyInstaller. Cython is a toolchain that can convert Python code (with a
few minor restrictions) into C code, and then you can compile the C code
into machine code. Cython by default creates CPython extentions, so you
can import the Cython modules from normal Python modules. Thus, you can
compile most of your application with Cython to create machine code
(thus hiding the source code), and you can use just a small Python
bootloader that imports your Cython code. Then you point PyInstaller at
the Python bootloader and you use that to make the PyInstaller executable.

Cython is very interesting behind the scenes. It does turn Python into
C, but the generated C code uses the Python.h library extensively.
Cython is also nice because you can use optional static type
declarations, which make your code faster - often Cython is 100 to 1,000
times faster than normal Python. And the code still looks like Python,
it is great.

Good luck,

Zak Fallows

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: IOError raised when updating cache

Martin Zibricky
In reply to this post by jelle feringa
jelle feringa píše v Po 11. 03. 2013 v 09:51 -0700:
> I've used the following commands to package: pyi-makespec --onedir
> --name="SimplestTraits" --out=build --noconsole --debug
> simplest_traits.py pyi-build SimplestTraits.spec

Could you try the following?
- just use directly command 'pyinstaller'
- or use directly 'pyinstaller.py' from the tarball without doing
   'python setup.py install'

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: IOError raised when updating cache

jelle feringa
Hi Martin,

Thanks for your suggestion,

- just use directly command 'pyinstaller'
- or use directly 'pyinstaller.py' from the tarball without doing
   'python setup.py install'

Alas, it returns the exact same traceback...
Debugging show that the offending statement is called in PyInstaller/build, line 1246:

   1245             if typ in ('EXTENSION', 'BINARY'):
   1246                 fnm = checkCache(fnm, self.strip_binaries,
   1247                                  self.upx_binaries and (is_win or is_cygwin)
-> 1248                                  and config['hasUPX'], dist_nm=inm)

Thanks,

-jelle

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: IOError raised when updating cache

jelle feringa
In reply to this post by Zak
Hi Zak,

I just want to clarify for everyone reading this: PyInstaller bundles
basically do include the Python source code for your application, the
bundle could be deconstructed to reveal the source code. PyInstaller
provides convenience, but it does not provide secrecy.

Ai, I might have forced you to write a long, informative mail due to my misperception.
However, thanks for the informative and interesting suggestion, I would have never thought of that!

Thanks,

-jelle

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: IOError raised when updating cache

Martin Zibricky
In reply to this post by jelle feringa
jelle feringa píše v Po 11. 03. 2013 v 09:51 -0700:
>
> With the following traceback you find below. Finally, its worth
> mentioning that I'm on osx 10.8 and use the 2.6 python interpreter.

You use the default python installation that is available on osx 10.8.
Does a simple 'helloworld' example works? Code like:

   print "Hello world!"

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: IOError raised when updating cache

Martin Zibricky
In reply to this post by jelle feringa
This is a regression in current dev version. I'm able to reproduce the
same error with the default python 2.6 from osx with simple 'hello
world' example.

jelle feringa píše v Po 11. 03. 2013 v 09:51 -0700:
> 23778 INFO: Removing
> dir /Users/jelleferinga/Documents/workspace/PyRAPID/Code/PyRAPID/build/dist/SimplestTraits 23797 INFO: building COLLECT out00-COLLECT.toc Traceback (most recent call last):   File "/usr/local/bin/pyi-build", line 9, in <module>     load_entry_point('PyInstaller==2.1dev-0f0f4a4', 'console_scripts', 'pyi-build')()   File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/cliutils/build.py", line 38, in run     PyInstaller.build.main(None, args[0], opts.__dict__["buildpath"], opts.__dict__["noconfirm"])   File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 1674, in main     build(specfile, buildpath)   File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 1627, in build     execfile(spec)   File "SimplestTraits.spec", line 24, in <module>     name=os.path.join('dist', 'SimplestTraits'))   File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 1218, in __init__     self.__postinit__()   File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 305, in __postinit__     self.assemble()   File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 1248, in assemble     and config['hasUPX'], dist_nm=inm)   File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 786, in checkCache     digest = cacheDigest(fnm)   File "/Library/Python/2.6/site-packages/PyInstaller-2.1dev_0f0f4a4-py2.6.egg/PyInstaller/build.py", line 740, in cacheDigest     data = open(fnm, "rb").read() IOError: [Errno 2] No such file or directory: 'Python'

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: IOError raised when updating cache

Martin Zibricky
In reply to this post by jelle feringa
Could you please try my branch it should be fixed there.

https://github.com/matysek/pyinstaller.git

jelle feringa píše v Po 11. 03. 2013 v 14:34 -0700:

> Alas, it returns the exact same traceback... Debugging show that the
> offending statement is called in PyInstaller/build, line 1246:
>
>    1245             if typ in ('EXTENSION', 'BINARY'):    1246
> fnm = checkCache(fnm, self.strip_binaries,    1247
>                self.upx_binaries and (is_win or is_cygwin) -> 1248
>                                and config['hasUPX'], dist_nm=inm)
>
> Thanks,
>
> -jelle
>

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: IOError raised when updating cache

Parkway
In reply to this post by Zak
Zak: Recently started testing PyInstaller to do precisely what you discuss wrt Cython.  Have experience with Python/Cython/etc. and it would be good to understand how it works step-by-step with PyInstaller - a link to a usage example would be ideal if available.  Thx.

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: IOError raised when updating cache

Parkway
Zak: Have it all working but wanted to ask about the "small Python bootloader" - I have something very simple, like:

file: myprogram.py

import mymodule

if __name__ == u'__main__':
    mymodule.main()


The myprogram module is a pyd which calls other pyd's and so on.  PyInstaller is pointed to myprogram.py.  Is this what you meant by a small Python bootloader?

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Zak
Reply | Threaded
Open this post in threaded view
|

Re: IOError raised when updating cache

Zak
Here is a full example that should work:

# File: my_library.pyx

def multiply(a, b):
    return a * b

# End of file


# File: my_app.py

import my_library

print my_library.multiply(3, 8)

Using Cython, you compile my_library.pyx into my_library.c. Then using GCC, you compile my_library.c into my_library.so. At this point, you can run my_app.py:

linux> python my_app.py
24

Then you bundle it with PyInstaller like this (the first line is severely simplified because I don't remember the necessary options):

linux> python pyinstaller.py my_app.py

linux> ./my_app
24

In this case, my_app.py is the "small Python bootloader". my_library.pyx contains the super secret source code that is now hidden. The key idea is that you point PyInstaller at my_app.py as the "base file" to be bundled.

My scheme never created any .pyd files, it created .so files instead.

Zak Fallows

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: IOError raised when updating cache

Parkway
Thanks Zak, we are on the same page.

--
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 http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.