Ask Your Question

Problem with in ipython notebook

asked 2013-07-25 09:08:41 -0500

I am getting this error while using on ipython notebook. It works perfectly in idle. I am using custom temp location on my windows 8.

IOError                                   Traceback (most recent call last)
<ipython-input-2-2556c4080454> in <module>()
----> 1

C:\Python27\lib\site-packages\SimpleCV\ImageClass.pyc in show(self, type)
   5446           else:
   5447               d = Display(self.size())
-> 5448 
   5449           return d
   5450         else:

C:\Python27\lib\site-packages\SimpleCV\ImageClass.pyc in save(self, filehandle_or_filename, mode, verbose, temp, path, fname, **params)
   2020                   tf.close()
-> 2022                   Idisplay.display(IPImage(filename=loc))
   2023                   return
   2024                 else:

C:\Python27\lib\site-packages\IPython\core\display.pyc in __init__(self, data, url, filename, format, embed)
    478         self.format = unicode(format).lower()
    479         self.embed = embed if embed is not None else (url is None)
--> 480         super(Image, self).__init__(data=data, url=url, filename=filename)
    482     def reload(self):

C:\Python27\lib\site-packages\IPython\core\display.pyc in __init__(self, data, url, filename)
    263             self.url = url
    264             self.filename = None if filename is None else unicode(filename)
--> 265         self.reload()
    267     def reload(self):

C:\Python27\lib\site-packages\IPython\core\display.pyc in reload(self)
    483         """Reload the raw data from file or URL."""
    484         if self.embed:
--> 485             super(Image,self).reload()
    487     def _repr_html_(self):

C:\Python27\lib\site-packages\IPython\core\display.pyc in reload(self)
    268         """Reload the raw data from file or URL."""
    269         if self.filename is not None:
--> 270             with open(self.filename, self._read_flags) as f:
    271        =
    272         elif self.url is not None:

IOError: [Errno 22] invalid mode ('rb') or filename: u'/tmp/e:\\temp\\tmprch1le.png'
edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2014-09-15 19:42:43 -0500

simplecv notebook does not work anymore since version 0.13.2 of ipython notebook, but you can still integrate () in ipython notebook easily with:

from SimpleCV import *
edit flag offensive delete link more

answered 2014-11-17 08:54:52 -0500

Had this problem. Not sure why it was happening. For me the solution was to go to the file itself, and find the following line inside the 'save' method (it was about line 2,019): loc = '/tmp/' +'/')[-1] Then I just changed it to: loc ='/')[-1]

And problem solved for now...

edit flag offensive delete link more

answered 2013-08-01 07:50:24 -0500

xamox gravatar image

I have not tested under windows 8 much. If you want a live display you will probably have to use .show() if it's in something like a while loop. I you are just testing on single images I recommend using the built in method we have for use in notebooks which will show them in the actual notebook.

from SimpleCV import Image, Display

disp = Display(displaytype='notebook')
img = Image('simplecv')

We also have a shortcut if you start from the command like that overrides the standard .show() function:

simplecv notebook

Then should do the same as above.

edit flag offensive delete link more

answered 2013-08-01 08:31:00 -0500

  1. I tried your first code from idle (along with import) and it gave me this error.

    Traceback (most recent call last):
      File "<module1>", line 4, in <module>
      File "C:\Python27\lib\site-packages\SimpleCV\", line 2022, in save
      File "C:\Python27\lib\site-packages\IPython\core\", line 480, in __init__
        super(Image, self).__init__(data=data, url=url, filename=filename)
      File "C:\Python27\lib\site-packages\IPython\core\", line 265, in __init__
      File "C:\Python27\lib\site-packages\IPython\core\", line 485, in reload
      File "C:\Python27\lib\site-packages\IPython\core\", line 270, in reload
        with open(self.filename, self._read_flags) as f:
    IOError: [Errno 22] invalid mode ('rb') or filename: u'/tmp/e:\\temp\\tmpggb8wk.png'

    I think there might be some problem with custom temp locations because the file location in the error message looks weird (my temp location is E:\Temp).

  2. Yes, all the time I was starting Simplecv notebook from cmd like that. And I was also trying to load single images only.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-07-25 09:08:41 -0500

Seen: 2,676 times

Last updated: Nov 17 '14