views:

325

answers:

1

I am in the process of migrating from an old Win2K machine to a new and much more powerful Vista 64 bit PC. Most of the migration has gone fairly smoothly - but I did find that I needed to reinstall ALL of my Python related tools.

I've downloaded the mechanize-0.1.11.tar.gz file and ran easy_install to install it. This produced C:\Python25\Lib\site-packages\mechanize-0.1.11-py2.5.egg.

I then ran a python script to test it, and it worked fine under the interpreter. But, when I ran py2exe to compile the script, I get a message that mechanize cannot be found.

I then moved the egg to a new folder, used easy_install to install it - and got every indication that it did install.

But, I still get the same message when trying to use py2exe - that mechanize does not exist!

I did a search for "mechanize" of the entire disk, and get only the 2 egg files as a result. What files should be produced by the install - and where should I expect them to be located?

Obviously, I'm missing something here...any suggestions?

Also, perhaps related, the python I am running is the 32 bit 2.5.4 version...which is what I had before and wanted to get everything working properly prior to installing the 64 bit version - plus, I don't see some of the tools (easy_install & py2exe) which seem to support the 64 bit versions. Is that part of the problem, do I need to install & run the 64-bit version - and will that be a problem for those who run 32-bit PC's when they run my scripts?

+1  A: 

There is a note on the py2exe site that it does not work if the source is in egg format:

py2exe does not currently (as of 0.6.5) work out of the box if some of your program's dependencies are in .egg form.

If your program does not itself use setuptools facilities (eg, pkg_resources), then all you need to do is make sure the dependencies are installed on your system in unzipped form, rather than in a zipped .egg.

One way to achieve this is to use the --always-unzip option to easy_install.

Which version are you running? The latest version listed at pypi.python.org is version 0.6.9 but there is no indication I can find if the problem with eggs is fixed in this release.

hughdbrown
I'm using the setuptools-0.6c9.win32-py2.5.exe installer for easy_install. I'v check the py2exe site, see the note you mentioned - and have tried to find a way to install mechanize so it is not an egg...On the Peak page http://peak.telecommunity.com/DevCenter/EasyInstall#command-line-options I see the list of options, tried -Z, no help - then noticed somewhere else it needs to follow "easy_install", NOT the file name...still won't work. I'm at the point where I need to get away from this, clear my mind - far too much information that doesn't seem to correlate...Thanks for the help...
I should point out that I think the problem is with the way easy_install (isn't) installing mechanize - NOT with the py2EXE utility. There is some painfully obvious point of using easy_install that I must be missing. As my wife often said, sometimes it takes a 2x4 - sometimes a slege hammer is called for...
I agree -- get easy_install to install mechanize as py2exe requires it: egg-free. I ran easy_install on mechanize as described and got a package that was not zipped in an egg file."easy_install --always-unzip mechanize" did the trick.
hughdbrown
So, this turned out to be the correct answer for you, right?
hughdbrown