Arcpy walk function not finding maps

1084
6
Jump to solution
11-25-2018 09:18 AM
RobertStevens
Occasional Contributor III

Why does the attached python code, which uses the walk() function in arcpy not display

the maps in the directories.

I attach the python code, its output, and the output of 'ls-FR'.

(Since ls does not understand the content of geodatabases, I elide those)

You will see that there are maps, geodatabases, layers, csv files. But

the maps never show up.

It appears to be a bug.

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

I believe you have run into a bug.  I get similar results if I point ArcPy Walk to a directory containing MXD files.  It will find LYR files but not MXD files.

UPDATE:  There were some old defects about this issue that were closed as "fixed," but obviously it wasn't fixed or didn't stay fixed.  A new bug has been logged, and you can attach your customer number to it:

BUG-000118382: arcpy.da.Walk does not recognize and report MXD map documents.

View solution in original post

6 Replies
JoshuaBixby
MVP Esteemed Contributor

I believe you have run into a bug.  I get similar results if I point ArcPy Walk to a directory containing MXD files.  It will find LYR files but not MXD files.

UPDATE:  There were some old defects about this issue that were closed as "fixed," but obviously it wasn't fixed or didn't stay fixed.  A new bug has been logged, and you can attach your customer number to it:

BUG-000118382: arcpy.da.Walk does not recognize and report MXD map documents.

curtvprice
MVP Esteemed Contributor

I don't see this is as a show-stopper at all... MXD files are system files, not inside the geodatabase. Why not use the standard python os.walk() to find them?

RobertStevens
Occasional Contributor III

Then why have the api at all?

Show stopper, no.

Just another example of my time having been wasted

acting as the QA for ESRI.

But after years of it I am no longer surprised.

0 Kudos
MichaelVolz
Esteemed Contributor

Have you tried os.walk to find mxd files to analyze instead of arcpy.da.Walk?  You could just look for the specific ".mxd" extension  in the file name and then interrogate that file for additional information.

0 Kudos
curtvprice
MVP Esteemed Contributor

The reason why, arcpy.da.Walk can search for things in the catalog. os.walk can't do that, for example it can't see data tables and feature datasets and feature classes inside a file or enterprise GDB.  For files, I bet os.walk is faster because it does not require the overhead of looking "through" the Catalog API. I would use it even if arcpy.da.Walk did work for that reason.

0 Kudos
RobertStevens
Occasional Contributor III

Michael and Curtis

I know that your replies are intended to be helpful. Thanks!

But my aim in posting this was to draw attention to the fact that this api, walk(), did not appear to be working, or that my understanding of it was mistaken. And, in the former case, to have it posted as a bug.

I am certainly aware of other ways to descend a file structure. The advantage of walk(), as you know, is that when it hits a subfolder which happens to be a file geodatabase it knows what to do, whereas native python methods do not.

Joshua Bixby has confirmed that it is a bug and I believe has filed it as such. Thanks! By posting it I hoped to prevent others from spending time and energy, as did I, on trying to use something which didn't work.