I was following a discussion from https://github.com/gopro/OpenGoPro/discussions/146. I connect my GoPro Hero 9 (firmware v1.21) to my MacBook Pro via USB. I am running code you provided AlanEbell in PyCharm with a little modification to account for the UUID (code is provided below). When I run the program, the code takes a photo and saves it onto the SD card in the GoPro but it does not download the photo onto my laptop and does not stop until I stop the program. When I tried gopro.shoot_video(10) the command would start taking a video but it would go over the 10 second duration until I manually stop the recording on the GoPro and the code. When I debug the issue I find out that the program is stuck at the command gopro.take_photo() or gopro.shoot_video() where the command is not being completed and that the command is going into an infinite loop at GoProCamera.py line 587 to 589 (for gopro.take_photo()) where ready = "" stating that it is still busy.
When I run the same code in Windows 10 (again in PyCharm), instead of getting an infinite loop I get an error message stating Connectionreseterror: [winerror 10054] an existing connection was forcibly closed by the remote host
What is weird is before I downgraded the firmware to v1.21, I ran the program and I was not able to take a photo or video but the program would be able to download the last saved photo/video from the SD card.
from goprocam import GoProCamera, constants
import netifaces as ni
interface_port = 0
ifaces = ni.interfaces()
for iface in ifaces:
try:
ip = ni.ifaddresses(iface)[ni.AF_INET][0]["addr"]
if ip.startswith("172."):
print(f"IP: {ip} from Interface {iface}")
interface_port = iface
except:
pass
def record_video(interface: str) -> None:
gopro = GoProCamera.GoPro(ip_address=GoProCamera.GoPro.getWebcamIP(
interface), camera=constants.gpcontrol, webcam_device=interface, api_type=constants.ApiServerType.OPENGOPRO)
try:
r = gopro.setWiredControl(constants.on)
gopro.checkResponse(r)
except:
pass # sometimes throws 500 server error when camera is already on wired control mode
print("Taking Photo")
r = gopro.take_photo(1) # Error creating infinite while loop in GoProCamera.py line 587 to 589
print(r)
print("Photo Taken")
gopro.downloadLastMedia()
r = gopro.delete(constants.Delete.LAST)
gopro.checkResponse(r)
exit()
record_video(interface_port)
MacOS Monterey 12.5.1
Windows 10
PyCharm
GoPro Hero 9 v1.21
@KonradIT
I was following a discussion from https://github.com/gopro/OpenGoPro/discussions/146. I connect my GoPro Hero 9 (firmware v1.21) to my MacBook Pro via USB. I am running code you provided AlanEbell in PyCharm with a little modification to account for the UUID (code is provided below). When I run the program, the code takes a photo and saves it onto the SD card in the GoPro but it does not download the photo onto my laptop and does not stop until I stop the program. When I tried
gopro.shoot_video(10)
the command would start taking a video but it would go over the 10 second duration until I manually stop the recording on the GoPro and the code. When I debug the issue I find out that the program is stuck at the commandgopro.take_photo()
orgopro.shoot_video()
where the command is not being completed and that the command is going into an infinite loop at GoProCamera.py line 587 to 589 (forgopro.take_photo()
) whereready = ""
stating that it is still busy.When I run the same code in Windows 10 (again in PyCharm), instead of getting an infinite loop I get an error message stating
Connectionreseterror: [winerror 10054] an existing connection was forcibly closed by the remote host
What is weird is before I downgraded the firmware to v1.21, I ran the program and I was not able to take a photo or video but the program would be able to download the last saved photo/video from the SD card.
MacOS Monterey 12.5.1 Windows 10 PyCharm GoPro Hero 9 v1.21