Skip to main content
Hi,

 

I create a fmw that : 1. create a directoy with the same name of zip file, 2. move the zip file to this directory. 

 

this fmw works fine withe if the name of file is note a numeric (like : toto.shp.zip, => OK but with another file that has only numeric name : 1.shp.zip => KO). 

 

With FME Desktop it works fine for both cases.

 

If i run it with FME SERVER, there is an error : 

 

 

54 WARN 0.2 1.3 2013-08-20 10:49:50 Python Exception : eErrno 2] No such file or directory: '\\\\\\\\1.shp.zip' 55 ERROR 0 1.3 2013-08-20 10:49:50 Error encountered while calling function `processFeature'

 

No more details for this error. 

 

 

Any help?

 

Thanks an advance.

 

 

Farfar
Hi Farfar,

 

 

Path delimiter may cause the error. How about using / (slash) instead of \\ (back slash)?

 

 

Takashi
Hi Takashi,

 

I use "join" to have a directory path. 

 

this my python script : 

 

def processFeature(feature):          #create work folder     fmebasename = feature.getAttribute("fme_basename")     workfolder = os.path.join(FME_MacroValuesM'workFolder'],fmebasename)          if not os.path.exists(workfolder):         os.makedirs(workfolder)     else:         #delete files ito work folder         os.chdir(workfolder)         filelist = glob.glob("*.shp.zip")         for f in filelist:             os.remove(f)          # move zip file into work folder     filename = fmebasename+".shp.zip"          fmedataset =  feature.getAttribute("fme_dataset")                end = fmedataset.find(fmebasename)        src_file = fmedatasetÂ0:end]              src_file = os.path.join(src_file, filename)          dst_file = os.path.join(workfolder, filename)     shutil.move(src_file, dst_file)              pass

 

 

Thanks 

 

Farfar
Hi,

 

I use my script in my previous message, i replace  :

 

workfolder = os.path.join(FME_MacroValuesu'workFolder'],fmebasename) 

 

by : 

 

workfolder = FME_MacroValueso'workFolder'] + "\\\\" + fmebasename.

 

 

And i still have the problem. 

 

 

Any Help? 

 

Thanks.

 

Farfar
Was a slash "/" also ineffectual?

 

 

Takashi
Hi Takasha,

 

I tested both of "//" ,  "\\\\" and "join" function and i've a same error. But if i use a non numeric file name, it works.

 

 

Farfar

 

 


Hi,

 

 

the simplest might be to insert

 

 

print "src_file:", src_file

 

 

or something like that at the end of your script. This  will print to the FME log window the actual values generated by your script. Let us know what it says so that we can try and help you find the error.

 

 

David
Hi David,

 

Thank you for your idea. The pb is the extract the value of "src_file" : the fme_dataset has a value that is in the path, so to split the path, its wrong. 

 

Example : 

 

   print "fmebasename:", fmebasename

 

    fmedataset =  feature.getAttribute("fme_dataset")  

 

    print "fmedataset :",fmedataset      end = fmedataset.find(fmebasename)        print "fmedataset:",fmedataset     print "end:",end     src_file = fmedatasetÂ0:end]

 

     print "src_file:", src_file

 

 

The result is : 

 

  fmebasename = 1

 

  fmedataset : \\\\\\\\1.shp.zip\\1.shp

 

  end:,2                  ==> WRONG

 

  src_file: \\\\1.shp.zip

 

 

I find now the origin of my error and fix it.

 

Thank you

 

 

Farfar

 

 

  

 

 

 

Reply