0

I am trying to use the python library for the GoPro API and I am new to this. I searched everywhere online and all posts seem to assume your camera is already paired with the computer. How do I connect my GoPro camera to the computer (wifi, USB?) so I can start talking to it via the python API ? I started by executing the following commands:

from goprocam import GoProCamera
from goprocam import constants
gpCam = GoProCamera.GoPro()

I get an error on line three and I assume it's because the camera is not yet connected to he computer.

Olivier Melançon
  • 21,584
  • 4
  • 41
  • 73
  • Please provide the error you are receiving. – MattMS Mar 26 '18 at 13:20
  • The error message is too long. But this is a snippet of first 2 lines: – Ayman Ismail Mar 26 '18 at 20:40
  • Traceback (most recent call last): File "C:\Python36\lib\site-packages\goprocam-1.9.6-py3.6.egg\goprocam\GoProCamera.py", line 144, in whichCam response_raw = urllib.request.urlopen('http://' + self.ip_addr + '/gp/gpControl', timeout=5).read().decode('utf8') – Ayman Ismail Mar 26 '18 at 20:40
  • You need to post the entire error, or at least post the last 10-20 lines. The last part of the error is usually where it explains what is going wrong. – MattMS Mar 27 '18 at 01:00
  • Ok. so I think I know the root cause. When I enable wifi on my GoPro, it will only showup on my computer WIfi networks if I hit Pair on the GoPro. The pairing will keep waiting for me to enter some code on the app side for 3 minutes, which is not the case because I am using the laptop. So I tried connecting within the 3 minutes and the error doesn't show anymore, however it times out after 3 minutes. So I guess the question is, how do I connect my GoPro to my laptop over wifi without using the pairing option on the camera ? – Ayman Ismail Mar 27 '18 at 12:39
  • Oh I see you're trying to pair. Connect the camera to your computer, and run gopro = GoProCamera.GoPro(constants.startpair) – konraditurbe Mar 27 '18 at 18:39
  • ok. I tried the pairing. "constants.startpair" is not defined, but I found "constants.pair". I executed this command and this is what I got: – Ayman Ismail Mar 28 '18 at 12:52
  • >>> GoProCamera.GoPro(constants.pair) Waking up... Waking up... Error, camera not defined. Make sure your GoPro camera is in pairing mode! Go to settings > Wifi > PAIR > GoProApp to start pairing. Then connect to it, the ssid name should be GOPRO-XXXX/GPXXXXX/GOPRO-BP-XXXX and the password is goprohero Enter pairing code: 9927 – Ayman Ismail Mar 28 '18 at 12:52
  • File "C:\Python36\lib\urllib\request.py", line 544, in _open '_open', req) File "C:\Python36\lib\urllib\request.py", line 504, in _call_chain result = func(*args) File "C:\Python36\lib\urllib\request.py", line 1361, in https_open context=self._context, check_hostname=self._check_hostname) File "C:\Python36\lib\urllib\request.py", line 1320, in do_open raise URLError(err) urllib.error.URLError: – Ayman Ismail Mar 28 '18 at 12:53
  • I need more context, is there a full log? Before running GoProCamera.GoPro(constants.pair) connect to the GoPro WiFi. I'll try to reproduce the bug, what is the output of python --version? – konraditurbe Mar 28 '18 at 13:39
  • The python version is:Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32. The log is too large. Is there a way to attach it to this post ? – Ayman Ismail Mar 28 '18 at 14:51
  • I finally figured it out. The issue was with my work computer. It must have had a firewall that prevented the script from recognizing the camera. I tried it from a personal computer and it worked like a charm. Thanks for the help – Ayman Ismail Mar 29 '18 at 00:29

1 Answers1

0

developer of gopro-py-api here. You need to turn on WiFi on your GoPro Camera, to App mode/Smartphone mode not Remote mode, then connect your camera to your computer via WiFi. Then run the commands again.

konraditurbe
  • 165
  • 9
  • I did that. I have a GoPro 4. I select Turn Wifi On then App Mode then it pops up with a pin number that I need to enter on the app side to pair and that pin will expire in 2.5 minutes then it turns off Wifi. I tried pairing it with my phone app so it that pin doesn't pop up anymore, which worked. I now can get past gpCam = GoProCamera.GoPro() but when i try gpCam.shutter(constants.start), I get the same error. – Ayman Ismail Mar 28 '18 at 12:00