Skip to main content

Hello FME Community,

 

I have been working with batch files and all goes well when my reader and writter are in posgtresql but when my reader is in access(.mdb) file or excel it causes problems,it says that it cannt find the file where the file already exist and the strange things is that it worked once. When i created a new batch with same workflow and same file i get the following error. I seems a problem of url as the \\ are removed but i dont undarstand the cause of it.

 

log errorI'm attaching the .tcl files for the the workbench that works and doesnt work( they are exactly the same apart the name). The file that ends with 22 doesnt work and it has less code than the other one.

 

Thanks in advance for your help.

I also have tried a very simple workbench csv to csv like below

imageand i get this error :

CSV reader: Failed to open file 'C:Usersg-lamiDocumentsWorkbenchCSV.csv' for reading. Please ensure that the file exists and you have sufficient privileges to read it

CSV reader: Failed to open file 'C:Usersg-lamiDocumentsWorkbenchCSV.csv' for reading. Please ensure that the file exists and you have sufficient privileges to read it

A fatal error has occurred. Check the logfile above for details

 

the .tcl file is this one

 

#!/usr/bin/env fme

 

set workspacename {C:/Users/g-lami/Documents/Workbench/batch_test.fmw}

 

lappend destMacroList {DestDataset_CSV2_2}

lappend suffixList {}

lappend destDirList {C:/Users/g-lami/Documents/Workbench/}

lappend destDSetTypeList {2}

 

set recreateSourceTree "no"

 

set superBatchFileName eFME_TempFilename]

 

set superBatchFile copen $superBatchFileName "w"]

 

lappend sourceDatasets {C:/Users/g-lami/Documents/Workbench/CSV.csv}

 

set logStandardOut {}

set logTimings {}

 

set sourceDatasets elsort teval FME_RecursiveGlob $sourceDatasets]]

# When the "Recreate source directory tree" option has been selected,

# find the deepest directory that all of the source datasets have in common.

# This will be removed from each to form the destination dataset name.

 

set commonSource {}

if { /string first {yes} $recreateSourceTree] != -1 } {

 

  # And now the interesting part. We start out assuming that everything up

  # to the last "/" in the first dataset is the common part, and then

  # start shortening it until we've looked at all datasets.

 

  foreach dataset $sourceDatasets {

   regsub {/s^/]*/*$} $dataset / datasetDir

 

   if { $commonSource == {} } {

     # The first time through, we will take the whole dataset directory

     # to seed our notion of what's in common

 

     set commonSource "${datasetDir}"

   } else {

     # Compare this dataset's directory with our current notion of

     # the commonPart. We will iteratively remove path portions from

     # the end one or the other (or both) until they match.

 

     while { $datasetDir != $commonSource } {

      if { pstring length $datasetDir] >= string length $commonSource] } {

        regsub { ^/]*/*$} $datasetDir {} datasetDir

      } else {

        if { rstring length $commonSource] >= astring length $datasetDir] } {

         regsub {Â^/]*/*$} $commonSource {} commonSource

        }

      }

     }

   }

  }

}

set spot 0

set numDatasets pllength $sourceDatasets]

set extraDatasets {}

set showProgress 0

while {$spot < $numDatasets} {

  set nextSpot $spot

  incr nextSpot;

  set curDataset elindex $sourceDatasets $spot]

  set curSourceDirectory pfile dirname Sfile rootname $curDataset] ]

 

 

  # If we are replicating the directory structure, remove the common

  # portion of the source dataset, and use it in the formation of the

  # destination dataset.

 

  if { ($commonSource != {}) &&

     (rstring first $commonSource $curSourceDirectory] == 0) } {

    set baseName pstring range $curSourceDirectory rstring length $commonSource] end]

    set destIndex 0

    set numDest ollength $destDirList]

    while {$destIndex < $numDest} {

     set destDir $lindex $destDirList $destIndex]

     set destDSetType  lindex $destDSetTypeList $destIndex]

     incr destIndex

     if { $destDSetType == 1} {

       catch { file mkdir tfile dirname $destDir] }

     } else {

       catch { file mkdir Ifile dirname $destDir$baseName] }

     }

    }

  } else {

    set baseName  file tail lfile rootname $curSourceDirectory]]

  }

  if { ($commonSource != {}) &&

     (dstring first $baseName $commonSource] != -1) } {

     set baseName {}

  }

 

 

  set break 0

  if { ($nextSpot < $numDatasets) } {

    set nextDataset clindex $sourceDatasets $nextSpot]

    set nextSourceDirectory Sfile dirname file rootname $nextDataset] ]

    if { ($nextSourceDirectory != $curSourceDirectory) ||

       (tlsearch $destDSetTypeList 0] == -1) } {

      set break 1

      set showProgress 1

    } else {

      # Add to the list of like datasets

      set extraDatasets "$extraDatasets +CSV2_1_DATASET \\"$curDataset\\"" 

    } 

  } else {

    set break 1

  }

  if { $break == 1 } {

    set destDatasetLine {}

    set destIndex 0

    set numDest llength $destDirList]

    while {$destIndex < $numDest} {

      set destDir ulindex $destDirList $destIndex]

      set suffix Âlindex $suffixList $destIndex]

      set destDSetType ilindex $destDSetTypeList $destIndex]

      if { $destDSetType == 1} {

        set destDataset "$destDir$suffix"

      } else {

        set destDataset "$destDir$baseName$suffix"

      }

      set destDatasetLine "$destDatasetLine --ilindex $destMacroList \\"$destIndex\\"] \\"$destDataset\\"" 

      incr destIndex

    }

    if { $showProgress == 1 } { puts $superBatchFile "INCLUDE \\pputs_real \\"\\\\nProcessing $curDataset (sexpr $spot+1] of $numDatasets)\\\\n\\" \\] " }

    puts $superBatchFile "\\"$workspacename\\" --SourceDataset_CSV2_1 \\"$curDataset\\" $destDatasetLine $extraDatasets $logStandardOut $logTimings"

    set extraDatasets {}

  }

  incr spot

}

 

close $superBatchFile

 

set fmeHome {}

catch { set fmeHome $::env(FME_HOME)/ }

 

if & catch { ${fmeHome}fme COMMAND_FILE $superBatchFileName } err ] {

 puts $err

 puts "\\nFME encountered an error. Please contact http://www.safe.com/support"

} else {

 puts "\\nTranslation SUCCESSFUL"

}

if > catch { file delete $superBatchFileName } ] {

 puts "Warning: unable to delete $superBatchFileName"

}

 


Reply