在python中为python中的openssl分配路径时不起作用

2024-06-30 12:57:02 发布

您现在位置:Python中文网/ 问答频道 /正文

p12_name = G72XN87TV
print(repositoryPath+ios_team_id)
cert_path1 = str(home + "/Documents/Automator/repository/"+ios_team_id+"/certs/distribution/"+p12_name+".cer")
print(cert_path1)
cert_path = '\"'+cert_path1+'\"'
print(cert_path)
        
cert_der = "\"" + "cert.der" + "\""
#encrypting the provisioning profiles and p12
print("\n\nopenssl", "aes-256-cbc", "-k", "vajr", "-in", cert_path, "-out", cert_der, "-a", "-d\n")
> output
openssl aes-256-cbc -k vajr -in "/Users/machd/Documents/Automator/repository/G72XN87TV/certs/distribution/3JGNP8TN9X.cer" -out "cert.der" -a -d
"/Users/machd/Documents/Automator/repository/G72XN87TV/certs/distribution/3JGNP8TN9X.cer": No such file or directory
4624252524:error:02FFF002:system library:func(4095):No such file or directory:/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-47.140.1/libressl-2.8/crypto/bio/bss_file.c:255:fopen('"/Users/machd/Documents/Automator/repository/G72XN87TV/certs/distribution/3JGNP8TN9X.cer"', 'r')
4624252524:error:20FFF002:BIO routines:CRYPTO_internal:system lib:/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-47.140.1/libressl-2.8/crypto/bio/bss_file.c:257:
Traceback (most recent call last):
  File "/Users/machd/Documents/Automator/automation/mew2.py", line 200, in <module>
    IOS(app_id, config_data, ios_project_folder, tobechanged_path, version_name, version_code, demo)
  File "/Users/machd/Documents/Automator/automation/IosFiles/ios.py", line 68, in __init__
    AutomateBuild(app_id, config_data, ios_project_folder)
  File "/Users/machd/Documents/Automator/automation/IosFiles/automateBuild.py", line 20, in __init__
    self.automate_build()
  File "/Users/machd/Documents/Automator/automation/IosFiles/automateBuild.py", line 117, in automate_build
    print(subprocess.check_output(["openssl", "aes-256-cbc", "-k", "vajr", "-in", cert_path, "-out", "cert.der", "-a", "-d"],cwd=repositoryPath+ios_team_id))
  File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['openssl', 'aes-256-cbc', '-k', 'vajr', '-in', '"/Users/machd/Documents/Automator/repository/G72XN87TV/certs/distribution/3JGNP8TN9X.cer"', '-out', 'cert.der', '-a', '-d']' returned non-zero exit status 1.

我使用代码来生成der文件,但是在变量中传递的路径被认为是无效的。在终端中发出该命令时,它正在工作,但在代码中,它没有将其视为路径


Tags: inpyidcertlineusersdocumentsfile