Added Support for automatic port change when image is streamed to browser.
When using browser display by calling img.show(type="browser") a JpegStreamer server is opened at a fixed port number of 8080. When this port is used by another server, an error is raised to reflect the fact that the port is already in use.
[Errno 98] Address already in use
To Replicate:
ipython notebook --port=8080
simplecv
>>> i = Image('lenna')
>>> i.show(type = 'browser')
Fix: The streamer is switched to adjacent port if the current port is busy. [ ipython like behaviour]
Implementation:
A global variable _port holds the current port number ( at start - 8080 )
Using try except block the exception is caught, the port number is incremented ( till port 8090 max ) and streamer initialization is tried again from the current port.
-repo has been pulled from sksavant's fork to build upon the bug fix #617 [ commit #169e090 ] since both these issues are related.
Added your commit, Fixed typo in #618 and some more changes in Stream.py to deal with jpgdata not filled in.
@sksavant:
Thats cool ... need to fix one more typo and code ... typo: line 6201-> till 8090
fix: do a _port increment before the while loop so that one unnecessary iteration is avoided inside the loop ( js = ... )
Will do that and push it in some time ... and one more thing, why can't we combine pull req #618 and #619 into one ... I dont know how to do it tho .. Do you know it ? or @xamox can u help us out ?
I pulled the above commit into my branch so it is now added to #618 . I don't think we can combine PRs.
ok
On Tue, Feb 25, 2014 at 3:11 AM, Savant Krishna [email protected]:
I pulled the above commit into my branch so it is now added to #618https://github.com/sightmachine/SimpleCV/pull/618. I don't think we can combine PRs.
Reply to this email directly or view it on GitHubhttps://github.com/sightmachine/SimpleCV/pull/619#issuecomment-35942617 .
Raghav Rv