Arc 10.1 Upgrade nuked my python path info

2317
5
08-24-2012 02:10 PM
MatthewGerbrandt
New Contributor II
My server was updated to ArcGIS 10.1 last week and now I'm unable to run python code from the command line. The error I get is:

The program can't start because python26.dll is missing from your computer. Try reinstalling hte program to fix the problem.


If I double-click on the C:\Python27\ArcGIS10.1\python27.exe executable, it will successfully open the command line interface. The C:\Python26\ArcGIS10.0\python26.exe throws the above error.

All I need to do is to be able to run python scripts from the Windows command line, for example:

c:\FolderName\python ScriptName.py


Anyone know what I need to do?
Tags (2)
0 Kudos
5 Replies
curtvprice
MVP Esteemed Contributor
This doesn't work?

E:\workspace> C:\Python27\ArcGIS10.1\python.exe scriptname.py


You want only one version of Python installed unless you absolutely require multiple versions, as it can be done but is a real pain. ArcGIS 10.1 Server requires Python 2.7 (64 bit, yay!)
0 Kudos
MatthewGerbrandt
New Contributor II
Thank you very much for your reply. The thing is, I can't run all my python scripts from the python27 directory. I need to be able to run them from anywhere on the computer.

It seems like I must need to update a registry setting or something? I need windows to understand that Python27 is the new and only way to go.

I went into Control Panel (Windows Server 2008) but did not see python listed in the Add/Remove programs area.

Any other ideas? Thanks a lot in advance!
0 Kudos
MatthewGerbrandt
New Contributor II
I tried running pyversioncheck.py from the following location: C:\Python27\ArcGIS10.1

I got the following output:

--- TEST VERBOSE=1
--- Testing existing and identical version file
VersionTestPackage: No correctly formatted current version file found
--- Testing existing package with new version
VersionTestPackage: No correctly formatted current version file found
--- Testing package with non-existing version file
VersionTestPackage: No correctly formatted current version file found
--- Test package with 2 locations, first non-existing second ok
VersionTestPackage: No correctly formatted current version file found
--- TEST VERBOSE=2
--- Testing existing and identical version file
VersionTestPackage:
  Checking http://www.cwi.nl/~jack/versiontestdir/Version10.txt
    No "Current-Version:" header in URL or URL not found
--- Testing existing package with new version
VersionTestPackage:
  Checking http://www.cwi.nl/~jack/versiontestdir/Version11.txt
    No "Current-Version:" header in URL or URL not found
--- Testing package with non-existing version file
VersionTestPackage:
  Checking http://www.cwi.nl/~jack/versiontestdir/nonexistent.txt
    No "Current-Version:" header in URL or URL not found
--- Test package with 2 locations, first non-existing second ok
VersionTestPackage:
  Checking http://www.cwi.nl/~jack/versiontestdir/nonexistent.txt
    No "Current-Version:" header in URL or URL not found
  Checking http://www.cwi.nl/~jack/versiontestdir/Version10.txt
    No "Current-Version:" header in URL or URL not found


Not sure what to make of that....
0 Kudos
curtvprice
MVP Esteemed Contributor
I went into Control Panel (Windows Server 2008) but did not see python listed in the Add/Remove programs area.


It looks like the 10.0 uninstaller removed Python 2.6 - but maybe not all of it. And it looks like your windows file associations maybe are still pointing .py files to Python26.exe - it should be opening all .py files with Python27.exe. this is why a repair install of Python 2.6 (from the 10.0 DVD) followed by an uninstall of 2.6 followed by a repair install of Python 2.7 (from the 10.1 DVD) may be the best fix.

Or you can try to go in brute-force and (as -pr) open windows explorer and in Tools / Folder Options make sure .py files are associated with the correct python.exe. But I've found that often just the repair-install approach seems to get everything done better in the long run, so I would try that first.

However, A manual thing you could and should do is remove any references to Python 2.6 from your system PATH variable. Installers usually aren't very good at editing the PATH.

The command line I gave would work from any folder, as it specifying the full path to the Python 2.7 executable. I formatted up my code block to make that more clear.
0 Kudos
EuanKilgour
New Contributor
What I did was specify the correct PATH and/or PYTHONPATH environment variable in Group Policy.  That way it will automatically fix anything that various (un)installers like to do to break your Python installation.  Good luck.
0 Kudos