IOError when JPG not in same directory

2010-06-24
2013-05-02
  • I see this forum is pretty quiet, but I hope someone is listening..

    This seems really silly, but I'm having a difficult time processing an image that lives outside the directory where ZoomifyFileProcessor.py lives. When I say for example:

    > python ZoomifyFileProcessor.py ../imagedir/foo.jpg
    

    …I get this error:

    Traceback (most recent call last):
      File "ZoomifyFileProcessor.py", line 132, in <module>
        processor.ZoomifyProcess(sys.argv[1:])
      File "ZoomifyFileProcessor.py", line 125, in ZoomifyProcess
        self.processImage()
      File "/usr/local/python-envs/myve/src/ZoomifyImage/ZoomifyBase.py", line 203, in processImage
        imageRow.save(os.path.join(tempfile.gettempdir(), saveFilename), 'JPEG', quality=100)
      File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1400, in save
        fp = __builtin__.open(fp, "wb")
    IOError: [Errno 2] No such file or directory: '/tmp/../imagedir/foo.jpg'
    

    If I copy foo.jpg so that it is sitting next to ZoomifyFileProcessor.py, it works just fine. I know I'm doing something stupid, but I can't figure out what it is!

    Any help most appreciated.

    Regards,

    -Stuart

     
  • adam smith
    adam smith
    2010-06-24

    Hi Stuart. I'm the original developer of this particular code and I still monitor this forum for the occasional problem report.

    I don't think you're silly or stupid: it sounds like a change I made in the not-too-distant past makes an assumption I didn't consider. I'm pretty slammed this week, and taking some time off next week, but I may be able to carve out some time in the next few days to look at this and try to fix it. Does this fit your time frame?

     
  • Adam, thanks so much for the prompt and helpful reply!

    That certainly does fit my time frame; I'm happy to get any help I can get, whenever I can get it! I have other aspects of this project on which I can focus in the meantime. That being said, I also wouldn't mind having a look at it myself if that would help, especially now that I'm more confident that it's actually a problem with the code and not just with me. Please let me know if you'd like me to have a look?

    Thanks and regards,

    -Stuart

     
  • adam smith
    adam smith
    2010-06-24

    I would definitely welcome the help, as I am not currently using this software on an active development project, and you are, you are the better tester. If you want, I can add you as a developer to the project (although I can't seem to see your SF username to add you).

     
  • Adam, I think I've got my SF account properly set up now. Feel free to add me to the project if you like. If you have any pointers or suggestions for me, in terms of where you think the change needs to be made, I'd love to hear them!

    Thanks again,

    -Stuart

     
  • adam smith
    adam smith
    2010-06-24

    Stuart,

    I've added you as a developer to the project with CVS access, etc., but this is my first time adding someone to a SF project, so let me know if you don't have the access you need.

    Now that I am looking back at the code in the ZoomifyProcess() method of the ZoomifyFileProcessor.py script, it is just assuming that you are passing in a file name in the same directory, and not a path. That was kinda dumb of me. I also had a note in a comment to allow passing in a directory and automatically processing all image files in that directory, which I haven't done yet.

    If you wanted to try dealing with at least your situation, that would be a nice improvement. Also, if you do, can you also retro-test it to still accept file basenames and assume that those are in the same directory? I want to be sure we don't break the expected functionality for existing users.

    As you may know, there is a test image in the distribution you can use also.

    Thanks for taking a swing at this!

     
  • adam smith
    adam smith
    2010-06-25

    Stuart,

    Just FYI, I am starting my week + a few days of vacation, but if you have any questions, I will be periodically checking email on this account: asmith at agile-software.com . Good luck!

    adam

     
  • adam smith
    adam smith
    2010-07-06

    Stuart,

    I am starting to recover from my vacation and thought I should check in with you. How are things going?

     
  • Hello Adam -

    Just after talking to you last, my client switched my priorities, so I have been away from this problem until today. I am back on Zoomify now and so I will be bouncing between implementing the zoomify control on their site and looking at what I need to do to process the images, including working out the directory issue we've been discussing.

    If you have some time to look at the directory issue, don't let me stop you! :) At the same time, I plan to look into it as well, so no worries if you have something more urgent with which to contend.

    Thanks for following up with me!

    -Stuart