I have this piece of python/tkinter code that is trying to rename a directory. When the call() gets executed it trows an error.
if os.path.exists(self.destDirectory):
self.now = datetime.datetime.now()
print(self.now)
self.now = str(self.now.strftime("%Y_%m_%d_%H_%M"))
print('rename {0} {1}'.format(self.destDirectory, 'old_' + self.now))
self.cmd1 = ('rename {0} {1}'.format(self.destDirectory, 'old_' + self.now))
self.returnCode1 = call(self.cmd1)
ERROR:
Exception in Tkinter callback Traceback (most recent call last):
File "C:\Python32\lib\tkinter\__init__.py", line 1399, in __call__
return self.func(*args)
File "C:\EclipseWorkspaces\csse120\Myproject\src\BoxRestore.py", line 95, in proceed
self.returnCode1 = call(self.cmd1)
File "C:\Python32\lib\subprocess.py", line 467, in call
return Popen(*popenargs, **kwargs).wait()
File "C:\Python32\lib\subprocess.py", line 741, in __init__
restore_signals, start_new_session)
File "C:\Python32\lib\subprocess.py", line 960, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
But When I do:
print('rename {0} {1}'.format(self.destDirectory, 'old_' + self.now))
And execute it in cmd I get no errors.
Another command Won't complain:
self.cmd2 = ('xcopy {0} {1} /I /E'.format(self.values['sourceButton'], self.values['destinationButton']))
self.returnCode = call(self.cmd2)
Can You Please Help.