You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 27, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 27, 2020. It is now read-only.
[chris@xps-void scan]$ python2 scan.py "scan.jpg" 600
Found scanner 'Canon TS5000 series._uscan._tcp.local.' at '975791000000.local.'
Traceback (most recent call last):
File "scan.py", line 49, in
tree = etree.parse(urllib2.urlopen(req))
File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 429, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 447, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1228, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>
my scanner/printer is on a fixed ip address, which works with scangearmp2
model Pixma TS5051
Your zeroconf installation may be not working. It apparently failed to resolve the name reported.
If you have a fixed IP, you can easily hardcode the IP.
But I believe the way to go is to integrate this into sane properly. So you can scan right from the different applications, can maybe do a preview scan, select a region, then scan that region with full resolution, etc.
This script is just a proof of concept.
P.S. try ping 975791000000.local.. If that does not work, then the zeroconf setup on your host is to blame, not my script. It just uses the host name it gets back from the zeroconf discovery.
To understand the error better: did the "ping" work for you, or did it not work?
The service.address field supposedly contains the IPv4 (does IPv6 also happen? I don't know) address of the device. But in binary, so it requires a little bit more effort to use than the host name. Then it would be robust to systems that do not have mDNS lookups set up correctly.
I don't consider urllib2.URLError: <urlopen error [Errno -2] Name or service not known> to be a crash, but a precise error message, in particular for a proof of concept code... hiding the traceback may be prettier, but makes debugging harder.
[chris@xps-void scan]$ ping 975791000000.local.
PING 975791000000.local. (192.168.0.60) 56(84) bytes of data.
64 bytes from 192.168.0.60 (192.168.0.60): icmp_seq=1 ttl=64 time=3.35 ms
64 bytes from 192.168.0.60 (192.168.0.60): icmp_seq=2 ttl=64 time=2.48 ms
wasted a bunch of time with avahi, and yes this is a system config issue at root, but the script should handle this gracefully, as an aside I notice this scanner works with sane locally ie via USB, odd how sane just doesn't see it over the network...
It's not that odd: the USB protocol apparently is something completely different than the WiFi protocol (which is HTTP based, and you don't want to use HTTP over USB). The different protocol may be necessary because of latency etc. and I wouldn't be surprised if the WiFi part / web server part itself is a separate system that also uses USB internally to communicate with the actual scanning hardware.
Yes, manufacturers make all kind of crazy solutions. My DSL modem reportedly has two separate subsystems for 2.4 GHz Wifi and 5 GHz Wifi. So I would not be surprised to see the WiFi part of the printer to be a separate embedded system connected to the actual printer by USB.
Activity
kno10 commentedon Mar 30, 2018
Your zeroconf installation may be not working. It apparently failed to resolve the name reported.
If you have a fixed IP, you can easily hardcode the IP.
chriscamacho commentedon Mar 30, 2018
yeah, fixing the IP address did it, maybe some error handling might help!
I've put together GUI's using pygtk, would this be worth doing ?
kno10 commentedon Mar 30, 2018
I had been considering that.
But I believe the way to go is to integrate this into sane properly. So you can scan right from the different applications, can maybe do a preview scan, select a region, then scan that region with full resolution, etc.
This script is just a proof of concept.
P.S. try
ping 975791000000.local.. If that does not work, then the zeroconf setup on your host is to blame, not my script. It just uses the host name it gets back from the zeroconf discovery.chriscamacho commentedon Mar 31, 2018
I gave up with avahi in the end as mDNSResponder just worked out of the box... (in case anyone else sees this issue)
I still thing this error should be caught and some kind of error produced rather than just crashing...
kno10 commentedon Apr 11, 2018
To understand the error better: did the "ping" work for you, or did it not work?
The
service.addressfield supposedly contains the IPv4 (does IPv6 also happen? I don't know) address of the device. But in binary, so it requires a little bit more effort to use than the host name. Then it would be robust to systems that do not have mDNS lookups set up correctly.I don't consider
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>to be a crash, but a precise error message, in particular for a proof of concept code... hiding the traceback may be prettier, but makes debugging harder.chriscamacho commentedon Apr 11, 2018
since using mDNSResponder
[chris@xps-void scan]$ ping 975791000000.local.
PING 975791000000.local. (192.168.0.60) 56(84) bytes of data.
64 bytes from 192.168.0.60 (192.168.0.60): icmp_seq=1 ttl=64 time=3.35 ms
64 bytes from 192.168.0.60 (192.168.0.60): icmp_seq=2 ttl=64 time=2.48 ms
wasted a bunch of time with avahi, and yes this is a system config issue at root, but the script should handle this gracefully, as an aside I notice this scanner works with sane locally ie via USB, odd how sane just doesn't see it over the network...
kno10 commentedon Apr 11, 2018
It's not that odd: the USB protocol apparently is something completely different than the WiFi protocol (which is HTTP based, and you don't want to use HTTP over USB). The different protocol may be necessary because of latency etc. and I wouldn't be surprised if the WiFi part / web server part itself is a separate system that also uses USB internally to communicate with the actual scanning hardware.
Yes, manufacturers make all kind of crazy solutions. My DSL modem reportedly has two separate subsystems for 2.4 GHz Wifi and 5 GHz Wifi. So I would not be surprised to see the WiFi part of the printer to be a separate embedded system connected to the actual printer by USB.