POST
|
Do these steps in order and you should be okay: Copy the Desktop10.2.pth file and move it to the Python installation you want to keep: D:\Program Files\Python27\Lib\site-packages Delete the entire Python installation you don't want to keep. Just hit the delete key and remove the whole folder: D:\Program Files\Python27\ArcGIS10.2 Go into System Properties->Advanced->Environment Variables and take a look at the "Path" System Variable. There should be only two reference to any Python folder there: D:\Program Files\Python27 and D:\Program Files\Python27\Scripts. If those aren't there, add them. If any other Python-related path is there, delete it. Check to see if you have numpy 1.6.x and matplotlib 1.1.x installed. If not, install them. If you want to match the ArcGIS installation you could add xlrd and xlwt as well. For future reference, running the ArcGIS installer will give you an option to skip the Python installation. You do this by selecting a "Custom" installation and then un-selecting Python. Thanks a lot Phil!
... View more
12-22-2013
08:46 AM
|
0
|
0
|
238
|
POST
|
Hello, Recently I have been trying to implement the "Make Raster Layer" tool in a python script. The code I have is as follow, which takes a file path as the major input with a boolean to indicate whether debugging messages should be output to a file. import arcpy debugmsg = "" # Receive the parameters from the toolbox dialog # - the path of the input image in_img_path = arcpy.GetParameterAsText(0) debugmsg += "input: " + in_img_path + "\n" # - the choice of outputting a debug text file debug = arcpy.GetParameter(1) # set up variables tmp = in_img_path.split("\\") layername = tmp[len(tmp)-1].split(".")[0] debugmsg += "layer name: " + layername + "\n" try: # -- generate a raster layer from image arcpy.MakeRasterLayer_management(imgname, layername, "#") debugmsg += arcpy.GetMessages()+"\n" except: debugmsg += "Make Raster Layer failed.\n" debugmsg += arcpy.GetMessages()+"\n" print debugmsg if debug: f = open(in_img_path[0:len(in_img_path)-4]+'_debug.txt', 'w') f.write(debugmsg) f.close() However, when I executed it, the Make Raster Layer function failed as indicated in the debugging output: input: I:\WIN\Desktop\image\big.png layer name: big Make Raster Layer failed. I used the same input directly in the Python window of ArcGIS and it succeeded with a layer named "big" shown up in the table of content. The command follows: arcpy.MakeRasterLayer_management(r"I:\WIN\Desktop\image\big.png","big") So, I am confused about why the same command executed differently. Does anyone have the same experience and hopefully a solution? Any suggestion is appreciated. Some screenshots of invoking the script and the execution result for your reference: [ATTACH=CONFIG]30058[/ATTACH] [ATTACH=CONFIG]30059[/ATTACH]
... View more
12-20-2013
06:30 PM
|
0
|
4
|
4808
|
POST
|
Thanks to you all for replying. Turned out that the problem was caused by my screwing up the Python installation folder. I repaired ArcGIS from CD and everything went back to normal.
... View more
12-20-2013
07:33 AM
|
0
|
0
|
486
|
POST
|
From the executable file itself you're getting the error? Try downloading it again and running it from a different location. Worst case scenario is to get wxPython for your current version and architecture of python and download the source of the addin wizard (click "Download ZIP" in the bottom of the right sidebar) and run it from your IDE/Python.exe. Yes. And re-downloading and re-positioning wouldn't help.
... View more
12-20-2013
07:32 AM
|
0
|
0
|
486
|
POST
|
It sounds like you are running into the following bug: NIM091620 "ImportError: DLL load failed: %1 is not a valid Win32 application." Error displays when ArcMap launches a 64-bit Integrated Development Environment (IDE) as Editor or Debugger and the script imports arcpy. Are you using a 64-bit IDE? I am on a 64-bit Windows 7 but not linking any IDE to ArcMap.
... View more
12-20-2013
07:31 AM
|
0
|
0
|
486
|
POST
|
Yes. Yes. Yes. The default installation is usually: C:\Python27\ArcGIS10.2\... Yes, it is possible to have multiple installations of Python on your computer (intentionally or not). But only one can be the default installation recognized by Windows. If you want to use your own Python installation, I recommend doing that installation first, then installing ArcGIS (you'll be given the option to install Python or not). I don't personally recommend having multiple Python installations lying around unless you need them and know what you're doing. Yes. As long as you've installed Python 2.7.x and numpy, everything should work. This is a potentially very different and unrelated problem. You'll have to provide more specifics. Some information about Python installations and ArcGIS can be found at the bottom of this page. Thanks a lot philmorefield! Some follow-ups: Regarding the last question I asked: No worry about that. I figured out later that it was caused by my screwing up the Python27 folder and related registry with temptations of uninstallation and reinstallation. To fix that, I cleared up all copies of Python on my computer, installed a brand new Python2.7 (in D:\Program Files\Python27), and repaired ArcGIS from CD (with "its" Python installed in D:\Program Files\Python27\ArcGIS10.2 and registered). Everything worked fine in ArcGIS after doing these. Kind of following the above bullet and regarding your instruction on redirecting ArcGIS to use my installation of Python: So the fact is both copies exist and one nests in the other's folder. As suggested by you and most python users, maintaining only one copy of python is preferred. I prefer to keep my installation of Python since I have other non-ArcGIS related python projects using this copy. In this case, what should I do to let ArcGIS refer to my copy instead of its own copy and get rid of its own copy? I noticed that ArcGIS' copy contains more site-packages and its own configuration files (e.g., desktop10.2.pth). When redirecting, should I copy all these additional items over?
... View more
12-20-2013
07:24 AM
|
0
|
0
|
238
|
POST
|
Hello, Has anyone encountered the same error as following while running the addin_assistant.exe wizard? Any idea on how to overcome? Traceback (most recent call last): File "addin_assistant.pyw", line 2, in <module> File "addin_ui.pyc", line 5, in <module> File "wx\__init__.pyc", line 45, in <module> File "wx\_core.pyc", line 4, in <module> File "wx\_core_.pyc", line 12, in <module> File "wx\_core_.pyc", line 10, in __load ImportError: DLL load failed: %1 is not a valid Win32 application.
... View more
12-19-2013
12:19 PM
|
0
|
5
|
1202
|
POST
|
Howdy, I am a totally newbie to everything in ArcGIS related to Python, although I am familiar with Python on its own. I tried to search through the ArcGIS documentation for answers to the following basic questions but got overwhelmed and lost in the massive information. So if someone can give me direct answers or point me to specific references (not general please), I will very appreciate it. Questions: Does ArcMap 10.2 come with Python? i.e., if I don't install Python manually, will Python scripting work in ArcGIS? If the answer to the above question is yes, then ArcMap must have installed a copy of Python somewhere to be invoked. Where is this copy of Python used by ArcMap? Can I change it so ArcMap invoke another copy of Python that I installed manually? Similar to the first question, will a Python Add-in work if Python is not installed manually? What could possibly be the reason if ArcMap shows a command as missing in a toolbar from a Python Add-in? P.S., please consider all the above questions on a Windows 7 64-bit system.
... View more
12-19-2013
07:59 AM
|
0
|
4
|
405
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|