Functions arcpy don't retrieve data

34
3
06-02-2020 05:02 AM
Highlighted
by
New Contributor

Hi

I try to run python script with these functions:

arcpy.ListTables()

, arcpy.ListFeatureClasses()

or

,arcpy.ListWorkspaces("*", "FileGDB")

but all the functions return right results on one computer and return "None"  on another.

Folder with GDB files was copied to both of these computers and has access by ArcCatalog correctly from the both computers.

What might be the problem? May be any security?

Reply
0 Kudos
3 Replies
Highlighted
MVP Esteemed Contributor

The original ArcPy listing functions (ListTables, ListFeatureClasses, etc...) all depend on having the arcpy.env.workspace set.  Make sure the workspace is set to the same location on each machine, or the location it needs to be to see what you have copied over.

Reply
0 Kudos
Highlighted
by
New Contributor

Yes, of course the arcpy.env.workspace the same. But the problem solved.The path "d:\geodb\any.gdb" was specified in the configuration file. This representation of the path is correct for arcpy for the first computer, but invalid for the second computer. The path was rewritten in the following form "d:/geodb\\any.gdb" (backslash and two slashes) for the second computer. The both computers have the same OS version (windows 10). I don't know what settings do this depend on.

Reply
0 Kudos
Highlighted
MVP Regular Contributor

You might want to use some of several options to validate/normalize path names, for instance

import os

pth = "d:/geodb\\any.gdb"

os.path.normpath(pth)

'd:\\geodb\\any.gdb'

... sort of retired...