문제

파이썬 2.7

우분투 12.04

저는 작성한 프로그램의 실행 파일을 작성하려고합니다. 첫 번째 작업은 디렉토리를 작성하는 것입니다. 원본 코드를 실행할 때 완벽하게 작동 할 때 다음 오류가 발생합니다.

[Errno 13] Permission denied: '/"folder_name"'
.

폴더를 만드는 코드 :

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
.

도움이 되었습니까?

해결책

현재 사용자는 "/"에서 디렉토리를 만들려면 특권이 없습니다.그리고 Varible "fold_title"에는 Qoutation 마크가 있으며 경로에 Qoutation 마크가 정말로 필요하면 확인하십시오.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top