Sometimes "Invalid parameter value passed to function" when using ChangePrivileges

4725
8
08-10-2010 06:52 AM
RPW
by
New Contributor III
Hi,

I am automatically setting permissions on Feature Classes in ArcSDE using Python. The problem is that this only works if I run the script on the workstation; if I run it directly on the server where ArcSDE is installed, I get the following error message:

Invalid parameter value passed to function
Failed to execute (ChangePrivileges).


The command looks the same using both ways (print gp.GetMessages()):
Executing: ChangePrivileges <SDE_CONN_FILE>/<ADMIN_USER>.<FC> <USER> GRANT AS_IS <SDE_CONN_FILE>/<ADMIN_USER>.<FC>

The strange thing is that the FC is appended again in the end, although the syntax looks like this:
ChangePrivileges_management (in_dataset, user, view, edit)
But I don't think this is the reason, since it works on the workstation.

Here is the code:
# Process only FC where admin_user has access -> wildcard
  wildcard = "%s.*" % admin_user
  fcs = gp.ListFeatureClasses(wildcard)
  fcs.reset()
  fc = fcs.next()
  
  while fc:
   fc = conn_sde + "/" + fc
   print "Setting read permission on FC %s" % fc
   try:
    # Process: Change Privileges...
    gp.ChangePrivileges_management(fc, read_user, "GRANT", "AS_IS")
    print gp.GetMessages()
   except:
    # If an error occurred while running a tool print the messages
    print gp.GetMessages()
    return 1
   fc = fcs.next()


ArcGIS version: 9.2, SP6
ArcSDE version: ArcSDE for Oracle9i 9.2 Service Pack 3

Does anyone know why the same command would run on a workstation but not on the server?

Thanks a lot,

Ralph
0 Kudos
8 Replies
RandyKreuziger
Occasional Contributor III
You write that ArcSDE on the server is also running 9.2 but is there a chance it has a newer or older ArcGIS Desktop than your workstation?  Didn't the parameter list of the ChangePrivileges command change between versions?
0 Kudos
VinceAngelo
Esri Esteemed Contributor
If you enable tracing (with SDETRACELOC/SDETRACEMODE variables), you'll know what's wrong for sure,
but 92sp3 != 92sp6, so your PATH order in resolving SDE.DLL could be the deciding factor.

- V
0 Kudos
RPW
by
New Contributor III
You write that ArcSDE on the server is also running 9.2 but is there a chance it has a newer or older ArcGIS Desktop than your workstation?  Didn't the parameter list of the ChangePrivileges command change between versions?


It is the same ArcGIS version (9.2) on both the workstation and the server, and I think also the same SP; but I will check this.

Thanks,
Ralph
0 Kudos
RPW
by
New Contributor III
If you enable tracing (with SDETRACELOC/SDETRACEMODE variables), you'll know what's wrong for sure,
but 92sp3 != 92sp6, so your PATH order in resolving SDE.DLL could be the deciding factor.


I will try to enable the tracing. I don't understand the thing with the PATH order and the SDE.DLL; are these critical for the ChangePrivileges cmd or for the tracing?

Thanks,
Ralph
0 Kudos
VinceAngelo
Esri Esteemed Contributor
If you have ArcSDE 9.2sp3 and ArcGIS 9.2sp6 on the same host, they will both have
a DLL named "SDE.DLL", but one will be SP3 and one will be SP6.  The LoadLibraryEx()
function is used to load dynamic libraries, and it searches directories in the order
specified by the PATH variable.  If your SP3 bin directory is before the SP6 directory,
then the 92sp6 ArcGIS will use the outdated DLL, making it unreliable.

There are a multitude of reasons to install ArcSDE 9.2 SP6 and the post-SP6 patches;
eliminating search order conflicts as a possible problem is one of the less pressing ones,
but if it works, then the other issues won't give you trouble either.

- V
0 Kudos
RPW
by
New Contributor III
If you have ArcSDE 9.2sp3 and ArcGIS 9.2sp6 on the same host, they will both have
a DLL named "SDE.DLL", but one will be SP3 and one will be SP6.  The LoadLibraryEx()
function is used to load dynamic libraries, and it searches directories in the order
specified by the PATH variable.  If your SP3 bin directory is before the SP6 directory,
then the 92sp6 ArcGIS will use the outdated DLL, making it unreliable.

There are a multitude of reasons to install ArcSDE 9.2 SP6 and the post-SP6 patches;
eliminating search order conflicts as a possible problem is one of the less pressing ones,
but if it works, then the other issues won't give you trouble either.


Thanks for the detailed explanation. I will be able to have a look at this next week. And yes, probably it would not harm to install some SPs and patches 🙂

Cheers,
Ralph
0 Kudos
RussellBrennan
Esri Contributor
Ralph,

One other thing to double check is to ensure that the SDE connection file that you are using on the server is using exactly the same connection properties as the one you are using on the client machine.
0 Kudos
RPW
by
New Contributor III

One other thing to double check is to ensure that the SDE connection file that you are using on the server is using exactly the same connection properties as the one you are using on the client machine.


Russell,
I am using exactly the same SDE connection file.

Thanks,
Ralph
0 Kudos