Code: Alles auswählen
import time
import os
import shutil
import cPickle as p
import subprocess
import sys
def text_menue():
print """
Wilkommen!
Druecken Sie die...
1 um zu starten,
2 um die Optionen zu aendern,
3 um zu beenden"""
def programm_start(exe_pfad):
subprocess.Popen(exe_pfad)
sys.exit()
def saver(zeit_str, saver_pfad):
ordner = os.mkdir(zeit_str)
objekte = os.listdir(saver_pfad)
for i in objekte:
shutil.copy2(i, ordner)
while True:
text_menue()
eingabe = input('Eingabe: ')
if eingabe == 1:
pfad1 = raw_input('save_pfad angeben: ')
pfad2 = raw_input('exe_pfad angeben: ')
uhrzeit = time.strftime('%a_%d_%b_%Y_%H_%M_%S')
saver(uhrzeit, pfad1)
programm_start(pfad2)
sys.exit()
elif eingabe == 2:
print 'kommt noch'
elif eingabe == 3:
sys.exit()
else:
print 'Nicht verfuegbar'
- Traceback (most recent call last):
File "C:\Python25\Quelldateien\saver\2.py", line 35, in <module>
saver(uhrzeit, pfad1)
File "C:\Python25\Quelldateien\saver\2.py", line 24, in saver
shutil.copy2(i, ordner)
File "C:\Python25\lib\shutil.py", line 89, in copy2
if os.path.isdir(dst):
File "C:\Python25\lib\ntpath.py", line 270, in isdir
st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NoneType found