Python script works in 2.7 but not 2.6?

1460
6
03-28-2017 01:19 AM
TheoFaull
Deactivated User

Hi. I have a script created in Python 2.7.10. It runs without issue on a machine with 2.7.10 installed:

(spreadsheet>>>XY Event Layer>>>Feature Class)

But on a machine with 2.6.5 installed, it errors. Why is this?:

Is it because I'm trying to make an XY event layer from a sheet within an Excel spreadsheet, and I don't have Microsoft Office installed on this second machine (no licence)? Screenshot below shows the spreadsheet needed for the XY event layer, and it's showing up as an unassociated file type (no program found to open it).

I didn't think Microsoft Office would be needed for Python to be able to extract a sheet. I've also experimented with making a CSV version of the file and pointing the script to use that, but the same error appears.

Any thoughts most welcome!!!

0 Kudos
6 Replies
DanPatterson_Retired
MVP Emeritus

Well, it could be the simple reason that python 2.7.* is required for ArcMap related scripts.  Otherwise you would have to dig in the changelog between python 2.6 and 2.7 to see what changed there.  There is no reason for 2.6 to be installed and/or used on a machine with ArcMap.  Uninstall it and use 2.7.  And .xlsx files aren't support in those lower versions anyway, when you get it resolved use .xls files

TheoFaull
Deactivated User

'python 2.7.* is required for ArcMap related scripts'

ah I didn't know. Thanks.

2.6 isn't installed on a machine with ArcMap. It's on the server machine which runs ArcGIS Server 10.0. The server hosts and runs our company mapping interface and is stable. I've seen threads elsewhere advising not to update Python on a machine running older GIS software. So I'm tempted to keep 2.6 running on that machine as to not risking breaking anything...

from ESRI support site:

Dan_Patterson

0 Kudos
VinceAngelo
Esri Esteemed Contributor

ArcGIS 10.0 has been Retired for nearly 15 months. I'd be afraid to use the ancient Python that shipped with 10.0 for even non-ArcPy use.  Attempting to use a modern ArcPy script with an ancient ArcGIS build isn't likely to be successful.

TheoFaull
Deactivated User

Hi Vince. Thanks for the info. I'm learning Python 2.7 and writing scripts using Model Builder in 10.4, so I'm also keen to avoid becoming too involved with older Python versions.

Now although we have 10 desktops on ArcGIS Desktop 10.4, our server machine runs ArcGIS Server 10.0 purely because it works for our setup. IT created a test environment on a new machine with Server 10.4 on it last year but I couldn't figure out how to host our shapefiles and feature classes as 'live' data. I think I need more time to learn how to set it all up, but in the meantime I'm trying to juggle 10.4 and 10.0 at the same time.

We also ran in to many permission problems and errors (I don't even have access to download the install files from My.Esri site!

0 Kudos
VinceAngelo
Esri Esteemed Contributor

You'll probably want to detail your issues with 10.0->10.4 migration as a different question in a different group.  I had no significant problems porting some pretty complex ArcObjects Java SOEs from 10.0 to 10.1, then adding complexity and porting to 10.2, then 10.3, then 10.4, so you may be just dealing some of the fundamental changes that occurred at the 10.0-10.1 migration.

- V

DanPatterson_Retired
MVP Emeritus

I will have to agree with Vince... Python 3.x is now 8 years old and in version 3.7.  Very shortly your installation will fall into the same category as having to maintain Cobol... I would suggest an upgrade at some point since you are now beginning to reach the end of the useful limits of support.