Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"polling exception: a bytes-like object is required, not 'str'" #29

Open
Seeelefant opened this issue Feb 14, 2019 · 5 comments
Open

"polling exception: a bytes-like object is required, not 'str'" #29

Seeelefant opened this issue Feb 14, 2019 · 5 comments

Comments

@Seeelefant
Copy link

I installed sequoia-ptpy via pip, ran

from ptpy import PTPy
camera = PTPy()

and got

E 159369 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 160941 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 162515 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'

Please advice
--Seeelefant

@domenzain
Copy link
Contributor

Hi,

Could you try declaring PTPY_DEBUG=1 and running again.
Please post the output here.

Best,

@Seeelefant
Copy link
Author

Hi,
here it is:

Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from ptpy import PTPy
>>> PTPY_DEBUG=1
>>> camera = PTPy()
E 23178 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23179 ptpy.ptp[MainThread:recv:801] a bytes-like object is required, not 'str'
Traceback (most recent call last):
E   File "D:\Program Files\Python35\lib\site-packages\usb\core.py", line 223, in get_interface_and_endpoint
23184 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23195 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23203 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23208 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23217 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23220 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23223 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23227 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23230 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23233 ptpy.transports.usb[EvtPolling    :return self._ep_info[endpoint_address]
__poll_eventsKeyError:582] : 2
<DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File "D:\Program Files\Python35\lib\site-packages\ptpy\transports\usb.py", line 397, in __send
E 23244 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23249 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23250 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23252 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23254 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23255 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23258 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23260 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23262 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23263 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23264 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23268     ep.write(transaction)
  File "D:\Program Files\Python35\lib\site-packages\usb\core.py", line 387, in write
ptpy.transports.usb[    return self.device.write(self, data, timeout)EvtPolling
:  File "D:\Program Files\Python35\lib\site-packages\usb\core.py", line 940, in write
__poll_events:582]     intf, ep = self._ctx.setup_request(self, endpoint)
<DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'  File "D:\Program Files\Python35\lib\site-packages\usb\core.py", line 102, in wrapper

    return f(self, *args, **kwargs)E
  File "D:\Program Files\Python35\lib\site-packages\usb\core.py", line 215, in setup_request
23275     intf, ep = self.get_interface_and_endpoint(device, endpoint_address)
  File "D:\Program Files\Python35\lib\site-packages\usb\core.py", line 102, in wrapper
ptpy.transports.usb    [return f(self, *args, **kwargs)
EvtPolling  File "D:\Program Files\Python35\lib\site-packages\usb\core.py", line 225, in get_interface_and_endpoint
:    for intf in self.get_active_configuration(device):__poll_events
:582]   File "D:\Program Files\Python35\lib\site-packages\usb\core.py", line 102, in wrapper
    return f(self, *args, **kwargs)<DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'

  File "D:\Program Files\Python35\lib\site-packages\usb\core.py", line 236, in get_active_configuration
E     23283self.managed_open()
  File "D:\Program Files\Python35\lib\site-packages\usb\core.py", line 102, in wrapper
ptpy.transports.usb    [return f(self, *args, **kwargs)
EvtPolling  File "D:\Program Files\Python35\lib\site-packages\usb\core.py", line 120, in managed_open
:    self.handle = self.backend.open_device(self.dev)__poll_events
:582]   File "D:\Program Files\Python35\lib\site-packages\usb\backend\libusb0.py", line 485, in open_device
<DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23295 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23297 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23300 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23302 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23305 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23308 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23309 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 23313 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
    return _check(_lib.usb_open(dev))
  File "D:\Program Files\Python35\lib\site-packages\usb\backend\libusb0.py", line 431, in _check
    raise USBError(errmsg, ret)
usb.core.USBError: [Errno None] b'libusb0-dll:err [os_open] failed to open \\\\.\\libusb0-0001--0x04a9-0x32c0: win error: Das System kann die angegebene Datei nicht finden.\r\n'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Program Files\Python35\lib\site-packages\ptpy\__init__.py", line 114, in __new__
    device_info = plain_camera.get_device_info()
  File "D:\Program Files\Python35\lib\site-packages\ptpy\ptp.py", line 953, in get_device_info
    response = self.recv(ptp)
  File "D:\Program Files\Python35\lib\site-packages\ptpy\ptp.py", line 802, in recv
    raise e
  File "D:\Program Files\Python35\lib\site-packages\ptpy\ptp.py", line 799, in recv
    return super(PTP, self).recv(ptp_container)
  File "D:\Program Files\Python35\lib\site-packages\ptpy\transports\usb.py", line 478, in recv
    self.__send_request(ptp_container)
  File "D:\Program Files\Python35\lib\site-packages\ptpy\transports\usb.py", line 425, in __send_request
    self.__send(ptp)
  File "D:\Program Files\Python35\lib\site-packages\ptpy\transports\usb.py", line 402, in __send
    ('timeout' in e.strerror or
TypeError: a bytes-like object is required, not 'str'
>>> E 24888 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 26462 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 28037 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 29613 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 31200 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 32775 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
E 34357 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'

E 35932 ptpy.transports.usb[EvtPolling:__poll_events:582] <DEVICE ID 04a9:32c0 on Bus 000 Address 001> polling exception: a bytes-like object is required, not 'str'
Exception ignored in: <module 'threading' from 'D:\\Program Files\\Python35\\lib\\threading.py'>
Traceback (most recent call last):
  File "D:\Program Files\Python35\lib\threading.py", line 1288, in _shutdown
    t.join()
  File "D:\Program Files\Python35\lib\threading.py", line 1054, in join
    self._wait_for_tstate_lock()
  File "D:\Program Files\Python35\lib\threading.py", line 1070, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt

Best
--Seeelefant

@domenzain
Copy link
Contributor

Hi @Seeelefant,

Sorry for the lack of response.
In order to declare environment variables from within the python environment you need to do:

import os
os.environ["PTPY_DEBUG"] = "1"

Looking at the USB IDs, it looks ilke it is a Canon Digital Ixus 180.
Sadly this camera does not implement capture, but it should indeed communicate...

@ohuu
Copy link

ohuu commented Mar 12, 2020

I'm having the same problem. I have a Canon EOS Rebel T3. Did you get to the bottom of what's causing this @domenzain @Seeelefant?

@domenzain
Copy link
Contributor

Hi @PaperPlaneSoftware,

Please follow the instructions above and provide the logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants