[英]pyinstaller mkdir function won't work after creating executable
Python 2.7 Python 2.7
Ubuntu 12.04 Ubuntu 12.04
I'm trying to create an executable of a program I have written, the first thing it needs to do is create a directory, when running the source code it works perfectly, when I create an executable I get the following error: 我正在尝试创建一个我编写的程序的可执行文件,它需要做的第一件事是创建一个目录,当运行源代码时它工作正常,当我创建一个可执行文件时,我得到以下错误:
[Errno 13] Permission denied: '/"folder_name"'
The code for creating the folder: 用于创建文件夹的代码:
def create_folder(self, user_input):
"""create base folder"""
splitput = user_input.split('=')
fold_title = splitput[-1]
try:
print 'making folder'
os.mkdir('/'+fold_title, 0777)
print 'made folder'
except Exception as e:
print e
print 'failed to create folder'
returned_path = '/'+fold_title+'/'
returned_path = '/'+fold_title+'/'
print returned_path
return returned_path
The current user has no privilege to create a directory under "/". 当前用户无权在“/”下创建目录。 And there are qoutation marks in varible "fold_title", check it out if you really need qoutation marks in the path.
变量“fold_title”中有qoutation标记,如果你真的需要路径中的qoutation标记,请查看它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.