2011-02-23 4 views
1
def creating_folder_for_csv_files(cwd): 
    try: 
     os.makedirs(cwd+'\\migration_data\\trade') 
    except os.error, e: 
     print "Could not create the destination folder for CSV files" 
    # end of first try/except block 

    try: 
     os.makedirs(cwd+'\\migration_data\\voucher') 
    except os.error, e: 
     print "Could not create the destination folder for CSV files" 

내 코드에서 첫 번째 try/except 블록은 작동하지만 두 번째 코드는 작동하지 않습니다. 뭐가 문제 야?하나의 함수에서 여러 try/except가 작동하지 않습니다.

+6

'작동하지 않는다'는 의미에 대해 좀 더 자세히 설명해주세요. 예상되는 행동은 무엇이며, 대신 당신이 보는 행동은 무엇입니까? – phooji

+0

작동하지 않는다고 말하면 어떻게됩니까? 디렉토리를 만들지 않습니까? 그것은 예외를 던집니까? 둘 다? – Gabe

+1

하나 이상의 경로 구성 요소를 결합하려면 [os.path.join] (http://docs.python.org/library/os.path.html#os.path.join)을 사용하는 것이 좋습니다. – Paolo

답변

0

voucher 이미 존재할 수 있습니다.

관련 문제