AnsweredAssumed Answered

How do I call a Python 3.5 script from a Python 2.7 script?

Question asked by azatrain on Feb 14, 2017
Latest reply on Jan 8, 2018 by u0281276

I've got a situation where I have a data preparation script that I've been using for years that was written in Python 2.7.  We now want to add some functionality to that script that is only available in version 3.5 that comes along for the ride with ArcGIS Pro 1.4.1.  So I am doing something like this inside the 2.7 script:


 p = subprocess.Popen("D:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/python.exe ../ArcGISPro/ -rt all -vt electric -oc " + operCo, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)


The 3.5 script runs great on its own when it knows it's using the 3.5 interpreter, but it seems like some wires are getting crossed trying to run stuff across both versions.  I am getting this error:


from variables import File "../Common\\", line 21, in <module>

   import arcpy  File "d:\\program files (x86)\\arcgis\\desktop10.5\\ArcPy\\arcpy\\", line 22, in <module>

   from arcpy.geoprocessing import gp  

   File "d:\\program files (x86)\\arcgis\\desktop10.5\\ArcPy\\arcpy\\geoprocessing\\", line 14, in <module>

   from _base import *\ImportError: No module named _base


Can someone point me in the right direction on this?  Thanks a ton ...