0

So here is a script that is used to extract a specific file from multiple folders and subfolders. It run smooth, until the end.

import os, fnmatch, arcpy

arcpy.env.workspace = r'C:\Users\sysadmin\Desktop\DataMagement\Comp_3\SA_MGCP3.gdb'

fcMerged = 'MergedFeatureClass'
fcClipped = 'Extraction_Mine'
fcToClip = r'C:\Users\sysadmin\Desktop\DataMagement\SA.shp

filesMatched = list()

for root, subfolders, files in os.walk (r'C:\Users\sysadmin\Desktop\DataMagement\MGCP_Raw'):

    for f in fnmatch.filer(files, 'AAA010.shp'):

        filesMatched.append(os.path.join(root,f))

Here is the error

    arcpy.Merge_managment(filesMatched, fcMerged)

    arcpy.Clip_analysis(fcMerged, fcToClip, Extraction_Mine)

The error code reads:

Traceback (most recent call last)' File "C:\User\sysadmin\Desktop\test.py", line 17 in < module 7 > arcpy.Merge_management (filesMatched, fcMerged) Attribute error: 'Module' object has no attribute 'Merge_Management'

closed as off-topic by Vince, mkennedy, PolyGeo Mar 2 '16 at 21:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – Vince, mkennedy, PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

2

You have a typo:

arcpy.Merge_managment

should be:

arcpy.Merge_management
  • Also, the correct way to construct a list is:filesMatched = []. If you want to construct a tuple, it would be filesMatched = (). – RHB Mar 2 '16 at 19:08
  • And another typo. The correct syntax is fnmatch.filter(names, pattern). And I would imagine the pattern will need to contain wildcard characters, unless you only want it to match one file. Also, the fnmatch module is designed for Unix, and it looks like you are on a Windows machine. – RHB Mar 2 '16 at 19:16
  • Typo in Management capitalised – FelixIP Mar 2 '16 at 20:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.