On Sat, Aug 21, 2010 at 11:50 AM, Bradlee Landis
<bradleelan...@gmail.com> wrote:
> On Sat, Aug 21, 2010 at 11:25 AM, Anthony Tuininga
> <anthony.tuini...@gmail.com> wrote:
>>> How do I add something to the path? I can use the command line --path,
>>> but then it replaces it instead of appending to it, and --include-path
>>> isn't recognized, even though it's documentation.
>>
>> include-path should work fine on the command line and should add items
>> to the path. Can you show me exactly what you are doing?
>
> I am using cx_Freeze 4.2. When I do --help, it doesn't list
> --include-path as an option.

It will if you run the cxfreeze script -- in other words not by using
setup.py and distutils. In setup.py you would be far better off to
just do this

import sys

sys.path.append(....)

> `\Python26\python.exe setup_cx.py --include-path share\exposong\lib build_exe`
> usage: setup_cx.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
>   or: setup_cx.py --help [cmd1 cmd2 ...]
>   or: setup_cx.py --help-commands
>   or: setup_cx.py cmd --help
>
> error: option --include-path not recognized

Nope. See above. :-)

>>> I put path in Executable(), but it still can't find the modules that
>>> I've included. I put packages and package_dir in setup() and it still
>>> fails.

I'm not sure what your architecture is like but perhaps you would be
better of by simply adjusting sys.path directly in setup.py?

>> I'm not sure why you are trying to muck with the path anyway? You can
>> set the environment variable PYTHONPATH and that should work. Do you
>> have code that adds to sys.path inside your script?
>
> Yes, I do. I have a script, bin/exposong, that starts
> share/exposong/lib/. I've tried just using
> share/exposong/lib/exposong/__init__.py, but it fails still.

So can you simply do this?

import sys

sys.path.append("share/exposong/lib")

> It looks like I can set PYTHONPATH, it will work, but setting
> Executable(path=...) should work. Do you know for a fact that this is
> working correctly?

The path parameter in Executable will work but it is expecting a
__full__ path. So you need to do something like this

path = sys.path + ["share/exposong/lib"]

> I also have a plugin system that does some dynamic importing. I
> changed my code for now to do it statically, but it seems that
> Executable(include=...) doesn't work for me either. This needs to work
> if at all possible, but it's not necessary for now.

If you want these to be loaded dynamically from the file system you
might want to use include_files to simply copy the files to the target
directory and adjust sys.path in your script to include whatever place
you copied these.

Recognize one other thing: Executable() is meant for overriding stuff
that you want different in each executable. If you only have one
executable or they all use the same configuration you're better off
simply using the main setup() call.

Hope that helps!

Anthony

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
cx-freeze-users mailing list
cx-freeze-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cx-freeze-users

Reply via email to