piero.cavalieri

Strange string truncation in ArcToolbox

Discussion created by piero.cavalieri on Oct 10, 2011
Latest reply on Oct 10, 2011 by piero.cavalieri
Hi all,

I have a simple Python script, which should check if a text file exists, and if not, create it:

filename = "%s\\%s.sql" % (sqlDir,viewName)
gp.AddMessage("Sql file: " + filename)
if not os.path.exists(filename):
  ecc.

Running the script from an IDE (I use PyScripter) it works fine (the debugger also displays correctly the filename)
Running it from the ArcToolbox, the directory part of the file path is removed, i.e. gp.AddMessage("Sql file: " + filename) prints only "\\viewName", so the line

if not os.path.exists(filename):

Can anyone explain me why this weired behaviour ?

Outcomes