I am trying to pass the variable dirpath into the export_data() function. Export data runs off of a double click on a button located on a widget. Why is dirpath printing as:
`<Tkinter.Event instance at 0x8ade56c>`
instead of the actual path?
def export_data(dirpath):
print 'exporting...'
print str(dirpath)
os.mkdir('/home/bigl/Desktop/Library')
shutil.copytree(dirpath, output_path)
When I run my code I get the error
exporting...
<Tkinter.Event instance at 0x8ade56c>
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
return self.func(*args)
File "/media/LOFTUS/20130308_searchtest.py", line 44, in export_data
shutil.copytree(dirpath, output_path)
File "/usr/lib/python2.7/shutil.py", line 169, in copytree
names = os.listdir(src)
TypeError: coercing to Unicode: need string or buffer, instance found
dirpathis a global variable; it's the argument of yourexport_data()function, hence local.