richard kappler
2015-09-14 14:29:37 UTC
Still working on my data feed script, if you'll recall from previous
emails, it reads incoming data and creates a name for image files based on
the incoming data in a test environment. below is a snippet of that code
that copies the next image in the pool renaming it as it copies, sends to
another machine via ftp, the closes the file and *** should then delete the
file *** but does not.
img = str(i) + '.jpg'
ID = device + '_' + timestamp + '_' + counter + '.jpg'
src = '/home/test/DataFeed/input/BOT/' + img
dst = '/home/test/DataFeed/output/BOT' + ID
shututil.copyfile(src, dst)
file = open(dst, 'rb')
sendBOT01.storbinary('STOR ' + ID, file)
file.close()
os.remove(file)
everything works except the os.remove(file) which gives the following error:
Traceback (most recent call last):
File "DataFeedBatch.py", line 104, in <module>
os.remove(file)
TypeError: coercing to Unicode: need string or buffer, file found
I don't understand the error
emails, it reads incoming data and creates a name for image files based on
the incoming data in a test environment. below is a snippet of that code
that copies the next image in the pool renaming it as it copies, sends to
another machine via ftp, the closes the file and *** should then delete the
file *** but does not.
img = str(i) + '.jpg'
ID = device + '_' + timestamp + '_' + counter + '.jpg'
src = '/home/test/DataFeed/input/BOT/' + img
dst = '/home/test/DataFeed/output/BOT' + ID
shututil.copyfile(src, dst)
file = open(dst, 'rb')
sendBOT01.storbinary('STOR ' + ID, file)
file.close()
os.remove(file)
everything works except the os.remove(file) which gives the following error:
Traceback (most recent call last):
File "DataFeedBatch.py", line 104, in <module>
os.remove(file)
TypeError: coercing to Unicode: need string or buffer, file found
I don't understand the error
--
All internal models of the world are approximate. ~ Sebastian Thrun
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
All internal models of the world are approximate. ~ Sebastian Thrun
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor