我正在使用Python(3.7)中,我需要创建一个临时目录中的子目录的一个项目,我已经创建了我的临时目录:
tempdir = tempfile.mkdtemp()
saved_unmask = os.umask(0o077)
temp_dir = os.path.join(tempdir)
然后我试图创建这个temp_dir
作为内的目录:
helm_chart = temp_dir + "/helmChart"
subprocess2.call(['helm', 'create', helm_chart])
helm creates path/sub_path
始终创建内部path
目录是temp_dir
在我的情况下,command
上面创建一个目录时,我通过另一个目录路径,但它不是建立内部temp_dir
的目录。
提前致谢!
以下可能的工作:
import os
os.makedirs(os.path.join(tempdir, 'helmChart'))
你有saved_unmask = os.umask(0o077)
,是你的脚本运行用户下?也许它没有写权限的临时目录