Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

myFileObject.delete() doesn't  RSS feed

 
Steve (Indiana) Jones
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WinXP and 2K server - While there are files remaining on an FTP site, a new File object is created that references a file retrieved from the site. The object is passed to a method that uses an API to copy the contents to a content management repository. When that is complete (begin trans/commit), I attempt to delete the file. The file in the first iteration through the method gets deleted. After that a file occasionally gets deleted. Objects all reference valid files, etc. This program runs as a nightly batch job on a server, so I hate the idea of using .delete() in some kind of loop with no guarantee that it will ever succeed. Thoughts? Thanks.
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What "API" is used to copy the files? Does this api close whatever stream/reader is used to read the file? That's the most common problem with File.delete.
 
Steve (Indiana) Jones
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. The API is Documentum content management. All the relevant method actually used from the File object was its getAbsolutePath method. It used that to copy the file to a filestore on the Documentum server. I've been attempting the .delete() after all the API stuff was done and committed.

A coworker suggested a satisfactory workaround. Instead of instantiating the File object in the calling loop and passing it to the method, I'm passing the path and filename. When everything is committed, I instantiate the object with the passed path and name, delete the file, and destroy the object.

I'm still curious about the original failure, but like most worthwhile knowledge, I haven't time to pursue it. Thanks again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!