[python-win32] Next step trying to include extra/external file in py2exe output

2011-05-24 Thread Jacob Kruger
Ok, when I now type in the following command:
python setup.py py2exe

with the following code in setup.py:
#start code

from glob import glob
from distutils.core import setup
import py2exe
data_files = [(Microsoft.VC90.CRT, glob(r'C:\Program Files\Microsoft Visual 
Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*'))]
setup(
console=[
dict (script=mapData.py)
],
data_files=[data_files],
options={
py2exe : {
includes : [c:\\temp\\pythonScripts\\mapDataFn.py]
}
}
) 

#end code

It seems to be generating the following exception/error, based on the line 
where I assume I'm trying to tell it to include the contents of the file, 
mapDataFn.py?

#error text from console window
raise ImportError, No module named  + qname
ImportError: No module named c:\temp\pythonScripts\mapDataFn

Should I rather copy that file to somewhere else, and then just tell it to do 
something like:
includes : [mapDataFn]

Or should I maybe just run an import higher up inside setup.py itself?

Sorry if I'm misunderstanding anything/everything...smile

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Next step trying to include extra/external file in py2exe output

2011-05-24 Thread Tim Roberts
Jacob Kruger wrote:
 Ok, when I now type in the following command:
 python setup.py py2exe
 ...
 It seems to be generating the following exception/error, based on the line 
 where I assume I'm trying to tell it to include the contents of the file, 
 mapDataFn.py?

 #error text from console window
 raise ImportError, No module named  + qname
 ImportError: No module named c:\temp\pythonScripts\mapDataFn

 Should I rather copy that file to somewhere else, and then just tell it to do 
 something like:
 includes : [mapDataFn]

Yes.  When you run py2exe, all of the modules you need should be laid
out on disk exactly as they would if you were running the script.  The
includes list, as you see, runs an import statement on the modules
you name.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Next step trying to include extra/external file in py2exe output

2011-05-24 Thread Tim Roberts
Jacob Kruger wrote:
 Ok, then why is it not picking up that the 2 files are in fact in same 
 folder at the time when I'm running the setup.py?

 All I have in the main file is the following in case that's an issue?:

 from mapDataFn import fnTakeItem

If you have main.py, setup.py, and mapDataFn.py, all in the same
directory, that should work just fine, without any includes overrides
at all.  What error do you see?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Next step trying to include extra/external file in py2exe output

2011-05-24 Thread Tim Roberts
Jacob Kruger wrote:
 #error text from console window
 raise ImportError, No module named  + qname
 ImportError: No module named c:\temp\pythonScripts\mapDataFn

 Should I rather copy that file to somewhere else, and then just tell it to 
 do something like:
 includes : [mapDataFn]

 Also tried changing it to:
 includes : [mapDataFn.py]

 and, same issue/error.

Here's a trivial example.  When I run python setup.py py2exe, it
creates dist\main.exe and dist\library.zip, and the zip contains
mapDataFn.pyc, among all the standard modules.

C:\Dev\xxxtype main.py
from mapDataFn import fnTakeItem

print fnTakeItem()

C:\Dev\xxxtype mapDataFn.py
def fnTakeItem():
return 123

C:\Dev\xxxtype setup.py
from distutils.core import setup
import py2exe

options = {
bundle_files: 1,
ascii: 1, # to make a smaller executable, don't include the encodings
compressed: 1, # compress the library archive
}

setup(
# The first three parameters are not required, if at least a
# 'version' is given, then a versioninfo resource is built from
# them and added to the executables.
version = 1.0.0,
description = Test,
name = MapTest,
options = {'py2exe': options},

# targets to build
console = [main.py],
)

C:\Dev\xxxpython setup.py py2exe
running py2exe
creating C:\Dev\xxx\build
creating C:\Dev\xxx\build\bdist.win32
creating C:\Dev\xxx\build\bdist.win32\winexe
creating C:\Dev\xxx\build\bdist.win32\winexe\collect-2.6
creating C:\Dev\xxx\build\bdist.win32\winexe\bundle-2.6
creating C:\Dev\xxx\build\bdist.win32\winexe\temp
creating C:\Dev\xxx\dist
*** searching for required modules ***
*** parsing results ***
*** finding dlls needed ***
*** create binaries ***
*** byte compile python files ***
byte-compiling C:\Dev\xxx\mapDataFn.py to mapDataFn.pyc
byte-compiling c:\apps\python26\lib\StringIO.py to StringIO.pyc

... lots of output deleted ...

C:\Dev\xxxcd dist

C:\Dev\xxx\distmain.exe
123

C:\Dev\xxx\dist

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32