issue creating new sde connection files with arcpy

Discussion created by emerickr on Mar 23, 2011
Latest reply on Mar 28, 2011 by hpbrantley
I've been creating new sde connection files in python (IDLE) just fine using the following code:

import arcpy
SDEPath = "Database Connections"
SDEName = "Connection to myservername.sde"
serverName = "myservername"
serviceName = "5151"
databaseName = "mydatabasename"
arcpy.CreateArcSDEConnectionFile_management(SDEPath , SDEName, serverName, serviceName, databaseName, authType)

These connections work just fine, they show up in ArcCatalog, etc. When I attempt to use the same code in the ArcGIS python interpreter, I get the following error and no connection is created:

Runtime error <class 'arcgisscripting.ExecuteError'>: Failed to execute. Parameters are not valid. ERROR 000840: The value is not a Encrypted String. Failed to execute (CreateArcSDEConnectionFile).

I get the same thing when I set
SDEPath = r"C:\myworkspace"
or any other literal path string.

Anyone have an idea of what is going on here?