0

Trying to decode a simple file into a temporary text file using the code below:

os.system("start cmd /k certutil -f -decode \\SDHQFILE03.enxco.com\\arcgis\\General\\Solar\\R_and_D\\CodeLibrary\\Python\\EPE2.1.7\\34287.bat \\SDHQFILE03.enxco.com\\arcgis\\General\\Solar\\R_and_D\\CodeLibrary\\Python\\SETI\test3.txt")

Everytime I run this I get an error from certutil that I have too many arguments (3 with 2 expected) - copying the code directly into the command window as shown it runs correctly:

certutil -f -decode \\SDHQFILE03.enxco.com\\arcgis\\General\\Solar\\R_and_D\\CodeLibrary\\Python\\EPE2.1.7\\34287.bat \\SDHQFILE03.enxco.com\\arcgis\\General\\Solar\\R_and_D\\CodeLibrary\\Python\\SETI\test3.txt

What am I missing on the first statement to allow it to run without error?

C. Nielsen
  • 11
  • 2
  • Try a raw string (an `r` at the front) so that the backslashes aren't escaped. as in `os.system(r"start cmd /k certutil -f -decode \\SDHQFILE03.enxco.com\\arcgis\\General\\Solar\\R_and_D\\CodeLibrary\\Python\\EPE2.1.7\\34287.bat \\SDHQFILE03.enxco.com\\arcgis\\General\\Solar\\R_and_D\\CodeLibrary\\Python\\SETI\test3.txt")` – tdelaney Jul 12 '21 at 22:36
  • always put full error message (starting at word "Traceback") in question (not comment) as text (not screenshot, not link to external portal). There are other useful information. – furas Jul 12 '21 at 23:18
  • 1
    `\t` has special meaning in Python - it is `tab` - even in string `SETI\text3.txt` - so you should use `SETI\\text3.txt` because it may tread single element `SETI\test3.txt` as two elements `SETI [tab] est3.txt` – furas Jul 12 '21 at 23:20

0 Answers0