|
DOC
|
Q: Are admin permissions required to install conda packages? A: If you have an "all users" install of ArcGIS Pro, the default install location is within the Program Files folder. To make changes to this folder location will require the applications to have elevated (admin) credentials. And since the Python environments is stored within the ArcGIS Pro application, then yes installing/removing/updating packages as well as creating and deleting environments will require elevated credentials. To get elevated credentials (admin privileges) from the Windows Application launcher you can right click on Command Prompt, or Python Command Prompt and choose Run as Administrator. It's a bit of a pain to use conda environments within an "all users" install without admin rights, but it can be done by using fullpaths > conda info --envs
# conda environments:
#
arcgispro-py3 C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3
root * C:\Program Files\ArcGIS\Pro\bin\Python
> conda config --add envs_dirs D:\conda
> conda create -y -p D:\conda\test python=3
etc...
> conda info --envs
# conda environments:
#
arcgispro-py3 C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3
test D:\conda\test
root * C:\Program Files\ArcGIS\Pro\bin\Python
> activate test
No environment named "test" exists in C:\Program Files\ArcGIS\Pro\bin\Python\envs, or is not a valid conda installation directory.
> activate D:\conda\test
[test] >
... View more
07-11-2016
05:26 PM
|
0
|
0
|
50929
|
|
POST
|
I agree with Shaun Walbridge - you should be able to run the python code directly. More info please. However, you can do something like the following: def runcmd(cmd):
"""
A generic subprocess.Popen function to run a command which suppresses consoles on Windows
Luke Pinner 2013
"""
if os.name=='nt':
#Windows starts up a console when a subprocess is run from a non-console
#app like pythonw unless we pass it a flag that says not to...
startupinfo=subprocess.STARTUPINFO()
startupinfo.dwFlags |= 1
else:startupinfo=None
proc=subprocess.Popen(cmd, startupinfo=startupinfo,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
if os.name=='nt':proc.stdin.close()
stdout,stderr=proc.communicate()
exit_code=proc.wait()
return exit_code, stdout, stderr
... View more
07-10-2016
03:56 PM
|
1
|
3
|
4053
|
|
POST
|
There are only two possibilities: If you don't have advanced or standard licenses available, you can't use the ImportXMLWorkspaceDocument tool. If the tool is running outside of ArcGIS, then you do have advanced or standard licenses available. You may be having trouble switching from a basic to a standard or advanced license.
... View more
07-06-2016
06:40 PM
|
0
|
0
|
1890
|
|
POST
|
You don't need to check out an extension, you need to ensure your ArcMap/Catalog is using a standard (aka arceditor) or advanced (aka arcinfo) level license, see Import XML Workspace Document—Help | ArcGIS for Desktop In your python toolbox, use the arcpy.ProductInfo() function in the "isLicensed" method in your tool to disable the tool if ArcMap/Catalog is using a basic/arcview license. import arcpy
class Toolbox(object):
def __init__(self):
self.label = "Toolbox"
self.alias = ""
# List of tool classes associated with this toolbox
self.tools = [Tool]
class Tool(object):
init code etc...
def isLicensed(self):
"""Set whether tool is licensed to execute."""
return arcpy.ProductInfo() != u'ArcView' The reason your code works when run from Python/IDLE is that when you import arcpy *from outside ArcGIS*, it will automatically grab the highest available license level (i.e it will try advanced if available, standard if not or basic if all else fails). You can specify what license level you want by using "import arcview, arcpy" or "import arceditor, arcpy" etc... NOTE: You can not use this method in your tool to change your current license level* *You might be able to work around this by ensuring the script is run outside of the current ArcGIS process (maybe using background geoprocessing, or the subprocess module to force a new python process), and then setting your license level in the script to standard or advanced.
... View more
06-29-2016
09:10 PM
|
1
|
2
|
1890
|
|
POST
|
I got it to work by adding the ECWs, then updating the stretched layer using a template RGB .lyr file: import os
workspace = r"C:\Temp\Test" #Workspace
rgb_lyr = arcpy.mapping.Layer(r"C:\Temp\rgb.lyr")
mxd = arcpy.mapping.MapDocument("CURRENT")
df = mxd.activeDataFrame
walk = arcpy.da.Walk(workspace)
for dirpath, dirnames, filenames in walk:
for filename in filenames:
print os.path.join(dirpath, filename)
lyr = arcpy.mapping.Layer(os.path.join(dirpath, filename))
arcpy.mapping.AddLayer(df, lyr)
updateLayer = arcpy.mapping.ListLayers(mxd, lyr.name, df)[0]
arcpy.mapping.UpdateLayer(df, updateLayer, rgb_lyr) You could also use replaceDatasource on the template layer: import os
workspace = r"C:\Temp\Test" #Workspace
rgb_lyr = r"C:\Temp\rgb.lyr"
mxd = arcpy.mapping.MapDocument("CURRENT")
df = mxd.activeDataFrame
walk = arcpy.da.Walk(workspace)
for dirpath, dirnames, filenames in walk:
for filename in filenames:
lyr = arcpy.mapping.Layer(rgb_lyr)
lyr.replaceDataSource (dirpath, 'RASTER_WORKSPACE', filename)
lyr.name = filename
arcpy.mapping.AddLayer(df, lyr)
... View more
06-21-2016
05:04 PM
|
1
|
1
|
4387
|
|
POST
|
It's linked to in a post above - arcgis desktop - Appending polygon feature classes with already repaired geometry => WARNING 000442: self intersections …
... View more
06-19-2016
08:16 PM
|
0
|
0
|
1089
|
|
POST
|
Dan, I agree with you re. ease of using external editors with arcpy. I think the OPs complaint was more about not being able to control a running application/map doc from python. Which to my mind is more in the realm of arcobjects.
... View more
06-19-2016
06:43 PM
|
2
|
0
|
1452
|
|
POST
|
John Bonifas wrote: ...Programmers who are reading this will instantly realize how crummy that is. I as a programmer can imagine how impossible it would be to try to develop scripts in Microsoft Office without the VBA Editor. It has 100% reliable access to *ALL* of the host applications' objects. Does anybody have inside information (Mr. Patterson....?) as to when ArcGIS 10 will have *ROBUST* support for external python editors. This is ridiculous!! Your analogy is poor. The VBA Editor is built in to the host Office application, it is not an external editor. A better analogy would be to compare the built in ArcGIS python window. This does have access to the current map document.
... View more
06-19-2016
04:42 PM
|
1
|
0
|
1452
|
|
POST
|
No idea, sorry. I just know that it's not in arcpy 10.2 or 10.3 on our systems. Is there really a need for it (other than to stop breaking existing code)? arcpy.AddMessage(msg), arcpy.AddError(msg) et. al all print to stdout (stderr?) anyway.
... View more
06-15-2016
03:52 PM
|
0
|
0
|
1147
|
|
POST
|
I don't think AddMsgAndPrint was ever an arcpy function. It's definitely not listed in the 10.3 or 10.2 help pages and calling arcpy.AddMsgAndPrint raises an "AttributeError: 'module' object has no attribute 'AddMsgAndPrint'" Are you sure you didn't have a custom module that defined AddMsgAndPrint? Something like: From: Tabulate Intersection—Help | ArcGIS for Desktop def AddMsgAndPrint(msg, severity=0):
# Adds a Message (in case this is run as a tool)
# and also prints the message to the screen (standard output)
#
print(msg)
# Split the message on \n first, so that if it's multiple lines,
# a GPMessage will be added for each line
try:
for string in msg.split('\n'):
# Add appropriate geoprocessing message
#
if severity == 0:
arcpy.AddMessage(string)
elif severity == 1:
arcpy.AddWarning(string)
elif severity == 2:
arcpy.AddError(string)
except:
pass
... View more
06-14-2016
10:14 PM
|
1
|
2
|
1147
|
|
POST
|
ArcGIS can read MrSID rasters natively, no extra software required (MrSID Gen 4. as of ArcGIS 10.1) Have you tried adding them to ArcMap? What happens? What version of ArcGIS are you using?
... View more
06-13-2016
09:36 PM
|
0
|
3
|
2716
|
|
POST
|
You don't need to put everything in a python add-in (unless you want to of course...). You can still have all the supporting modules in a single folder. How would you prefer to run your script? As a toolbox tool or an addin?
... View more
06-07-2016
04:13 PM
|
2
|
1
|
4012
|
|
POST
|
Just the dropbox directory. You'll also need the urllib3 and requests directories and six.py file as they're 3rd party libraries required by dropbox, see the "Requires Distributions" section in dropbox 6.4.0 : Python Package Index
... View more
06-06-2016
02:16 PM
|
2
|
5
|
4012
|
|
POST
|
You can distribute it with your code, i.e as a 'bundle of files'. The directory your script is in is part of the module search path - 6. Modules — Python 2.7.11 documentation So you would have something like: some_dir +-- your_script.py +-- dropbox You can also modify the search path at runtime, i.e with sys.path.append('path/to/folder/dropbox/is/in')
... View more
06-06-2016
03:09 AM
|
2
|
1
|
4012
|
|
POST
|
The installer exe is executable zip file. Just extract it using 7zip or similar and copy the numpy folder and numpy-1.7.1-py2.7.egg-info (they're under the PLATLIB folder in the extracted exe) to your virtualenvs site packages folder. Or you could copy them from your existing python installation, or even use virtualenv --system-site-packages so your virtualenv can access the already installed numpy and matplotlib.
... View more
06-02-2016
02:57 PM
|
1
|
2
|
4750
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-24-2022 03:08 PM | |
| 1 | 07-30-2025 03:00 PM | |
| 1 | 06-10-2025 08:06 PM | |
| 5 | 05-20-2025 07:56 PM | |
| 1 | 05-04-2025 10:34 PM |