Select to view content in your preferred language

Why is "updateDocSecurity()" is not running as documented?

904
5
09-09-2022 12:06 PM
JoshMakesMaps
Regular Contributor

updateDocSecurity() doesn't seem to be documented correctly and is not executing as expected in these scenarios:

  • Running 

 

pdfDoc.updateDocSecurity("123456", "123456", "RC4", "OPEN")​

 

returns this error:

 

TypeError: updateDocSecurity() takes from 2 to 4 positional arguments but 5 were given​

 

 

  • Running 

 

pdfDoc.updateDocSecurity("123456", "123456", "RC4")​

 

results in the process running forever.

 

  • Running

 

pdfDoc.updateDocSecurity("", "", "RC4")​

 

results in the process running successfully.

 

 

Any idea what's going on?

 

ArcGIS Pro 2.8.3

0 Kudos
5 Replies
DanPatterson
MVP Esteemed Contributor

python 3.0 documentation states with named parameters.

updateDocSecurity (new_master_password, {new_user_password}, {encryption})

or with your listing

pdfDoc.updateDocSecurity(new_master_password="123456",
                         new_user_password="654321",
                         encryption="RC4")

I suspect if the new user and master password are the same it will spin.

Change the first 2 parameters to suit.

Your first example failed because there is no 4th parameter (eg "OPEN" )


... sort of retired...
JoshMakesMaps
Regular Contributor

I tried it with the four parameters in the first example because that's how I saw in the example block on the documentation page. But yeah probably doesn't need that perimeter at all.

I have tried different variations of the passwords, also excluding only the master password or excluding only the user password. I still get the tool spinning forever.

0 Kudos
DanPatterson
MVP Esteemed Contributor

Using named parameters, as in my example, ensures that you have the correct parameter names.

The first parameter is required and must be known.

The second parameter is optional and its default is None.

If it is spinning, check your first parameter


... sort of retired...
JoshMakesMaps
Regular Contributor

It's still spinning forever after adjusting the script:

# Update PDF security.
            pdfDoc.updateDocSecurity(new_master_password="password123")

 and

# Update PDF security.
            pdfDoc.updateDocSecurity("password123")

 

0 Kudos
DanPatterson
MVP Esteemed Contributor

Tech Support is your best bet.  I can't find anything listed on the public support site.


... sort of retired...