Question about missing dll when calling executable

602
4
04-07-2010 03:05 PM
SamLitschert
New Contributor
Hi,
I've converted a python program to an .exe using py2exe. When I try to run it from the command line, I get the following error:
"The program can't start because GeoprocessingLib.dll is missing from your computer. Try reinstalling the program to fix this problem."

The GeoprocessingLib.dll is in C:\Program Files (x86)\ArcGIS\Bin.

I'm running ArcView 9.2, PythonWin 2.4 on Windows 7, 64 bit pc. Is the program just looking in the wrong place? How would I fix that? Does anyone have any idea what is wrong? The python exe will eventually be called from a vba application.

Thanks,
Sam
0 Kudos
4 Replies
JasonScheirer
Occasional Contributor III
you might want to look into excluding the arcgisscripting.pyd module in your exe project, so it will find the correct one via PYTHONPATH: http://www.py2exe.org/index.cgi/ExcludingDlls
0 Kudos
SamLitschert
New Contributor
Yes, I have tried excluding GeoprocessingLib.dll and GeoprocessingLib.pyd since I am not sure which to exclude. I still get the same error message.

What is the correct PYTHONPATH?

Thanks
Sam
0 Kudos
JasonScheirer
Occasional Contributor III
%installdir%\bin

Alternately, add os.environ["PATH"] += r";c:\program files\arcgis\desktop10.0\bin" to the very top of your Python script so it adds the ArcGIS install's bin to the DLL import path. You might want to make it more robust by looking for the correct install path with _winreg.
0 Kudos
SamLitschert
New Contributor
Thank you Jscheirer!

This code works with the line: import os before it.
s.
0 Kudos