Sometimes I have python code with conditional imports.

Sometimes I know, that the version, that I want to ship with ipython must not (will never) import certain dependencies.

Thus my question of how to tell pyinstaller to not 'autodiscover' certain conditional imports and its dependencies



Two examples:


1.) Alternative bindings
---------------------------
I have code, that uses try except to import either PyQt or PySide.
Obviously I don't want to ship with PySide and PyQT.



2.) Exclude optional modules
-------------------------------

There seems to be a bug in ipython, that causes my build to fail.

The problem is related to an import of Ipython.terminal.embed


For the time being (until I know the real solution for this issue)
I could live with the fact, that only my local release uses ipython and the version created with pyinstaller would not use ipython. (it's mostly for debugging anyway.)

Thus I had to know how to tell pyinstaller to NOT consider my conditional import of
Ipython.terminal.embed


To show you how my code would look like:

#!/usr/bin/env python
import sys

args = sys.argv[1:]
if len(args) >= 1 and args[0] == 'use_ipython':
    print("special functionality never being used with a "
           "pyinstaller version")
    from IPython.terminal.embed import InteractiveShellEmbed

print("this should work with pyinstaller")
print("ARGS %r" % args)
# ####### end of code

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

Reply via email to