KonradIT / gopro-py-api

Unofficial GoPro API Library for Python - connect to GoPro via WiFi.
MIT License
1.4k stars 211 forks source link

GoPro.mode throws timeout #173

Open Chrasonier opened 3 years ago

Chrasonier commented 3 years ago

Hey, I'm trying to change the mode of my GoPro Hero 7, but I'm getting a timeout error.

gpCam = GoProCamera.GoPro()
gpCam.mode(constants.Mode.Video)
gpCam.webcamFOV(constants.Webcam:FOV.Linear)

The .mode line fails, but the FOV line works without problems. I also tried

gpCam = GoProCamera.GoPro(constants.gpcontrol)
gpCam = GoProCamera.GoPro(mac_adress="")
and both together
gpCam = GoProCamera.GoPro(constants.gpcontrol, mac_adress="")

Error:

INFO:root:Starting GoPro
Waking up...
INFO:root:Started goprocam instance
Waking up...
Traceback (most recent call last):
  File "/usr/lib/python3.7/urllib/request.py", line 1324, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/lib/python3.7/http/client.py", line 938, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/usr/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/goprocam/GoProCamera.py", line 198, in sendCamera
    self.getPassword() + value_notempty)
  File "/home/pi/.local/lib/python3.7/site-packages/goprocam/GoProCamera.py", line 137, in _request
    return urllib.request.urlopen(uri, timeout=_timeout, context=_context).read().decode("utf-8")
  File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 1352, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/lib/python3.7/urllib/request.py", line 1326, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error timed out>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/Documents/Python/OLATest/olaTest.py", line 234, in <module>
    main()
  File "/home/pi/Documents/Python/OLATest/olaTest.py", line 199, in main
    gpCam = GoPro()
  File "/home/pi/Documents/Python/OLATest/GoProHandler.py", line 15, in __init__
    self.gpCam.mode(constants.Mode.VideoMode)
  File "/home/pi/.local/lib/python3.7/site-packages/goprocam/GoProCamera.py", line 386, in mode
    self.sendCamera("CM", mode)
  File "/home/pi/.local/lib/python3.7/site-packages/goprocam/GoProCamera.py", line 200, in sendCamera
    print("Error code:" + str(error.code) +
AttributeError: 'URLError' object has no attribute 'code'
>>>