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_MacroValues['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_MacroValues['workFolder'],fmebasename)
by :
workfolder = FME_MacroValues['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