Problem with Importing Exchange files while using an infile loop

Discussion created by ben_sloboda on May 16, 2012
Latest reply on May 16, 2012 by ben_sloboda
Hi! I have a python script that's supposed to walk through a directory and convert any e00 files, while renaming them with a date/time stamp. The following code works:

# Import arcpy module
import arcpy

# Local variables:
q3710583_e00 = "C:\\Data\\ExchangeFiles\\q3710583.e00"
ExchangeFiles = "C:\\Data\\ExchangeFiles"

# Process: Import from E00
arcpy.ImportFromE00_conversion(q3710583_e00, ExchangeFiles, "q37105830")

The following code does NOT work:

import arcpy, os, ctypes, datetime

count = 0
for infile in os.listdir(workspace):
    fileName, fileExtension = os.path.splitext(infile)
    if (fileExtension == '.e00'):
        arcpy.ImportFromE00_conversion(infile, workspace, "exchangeFile"+str(now.month)+"."+str("."+str(now.year))
        count += 1
        print str(count) + " files not converted"

I feel that the for loop is working, but the arcpy conversion fails every time with the following error:

Traceback (most recent call last):
File "C:/PythonScripts/", line 12, in <module>
arcpy.ImportFromE00_conversion(infile, workspace, "exchangeFile"+str(now.month)+"."+str("."+str(now.year))
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\", line 1054, in ImportFromE00
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input interchange file: Dataset q3710583.e00 does not exist or is not supported
Failed to execute (ImportFromE00).

There is nothing in my test folder except three e00 files, and I made sure to delete any extraneous files before attempting to run the code. If there is a better way to search through a folder and pull out specific files for conversion, I'm all ears! Or if there's something simply wrong in my code, I'd love to have someone tell me.


-Ben S.