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

How can I have set_shutter enable and disable in two different files #611

Open
OPEC239 opened this issue Sep 24, 2024 · 3 comments
Open
Labels
feedback requested Further information is requested python sdk Python SDK question A discussion / question. Not sure if bug or enhancement.

Comments

@OPEC239
Copy link

OPEC239 commented Sep 24, 2024

When I have the following in one file such as test.py
The gopro functions fine, start shooting and wait for 5 seconds stop shooting.

await gopro.http_command.set_shutter(shutter=Params.Toggle.ENABLE)
await asyncio.sleep(5)
await gopro.http_command.set_shutter(shutter=Params.Toggle.DISABLE)

But here comes the problem, if I put shutter enable in one file and shutter disable in another file, such as start.py and stop.py
so that I can control the shooting period only stops when I call stop.py
start.py works fine makes the gopro start shooting, but when I call stop.py gopro will not stop shooting, lookings the this file is waiting for a task to finish then starts to run.

Can someone help me out and give me a guide, thanks

@github-actions github-actions bot added the triage Needs to be reviewed and assigned label Sep 24, 2024
@KonradIT
Copy link
Contributor

Show your code for both start.py and stop.py

@OPEC239
Copy link
Author

OPEC239 commented Sep 25, 2024

Show your code for both start.py and stop.py

Start.py

import asyncio
from rich.console import Console
from open_gopro import WiredGoPro, Params
console = Console()
async def main():
try:
async with WiredGoPro() as gopro:
await gopro.http_command.set_shutter(shutter=Params.Toggle.ENABLE)
except Exception as e:
console.print(e)
asyncio.run(main())

stop.py

import asyncio
from rich.console import Console
from open_gopro import WiredGoPro, Params
console = Console()
async def main():
try:
async with WiredGoPro() as gopro:
await gopro.http_command.set_shutter(shutter=Params.Toggle.DISABLE)
except Exception as e:
console.print(e)
asyncio.run(main())

@tcamise-gpsw tcamise-gpsw added demos Relating to demos (not SDKs) and removed triage Needs to be reviewed and assigned labels Jan 7, 2025
@tcamise-gpsw
Copy link
Collaborator

If I'm understanding correctly, you are simultaneously connecting to the same gopro with two different WiredGoPro instances.

In general, this is not yet supported.
What is the actual benefit to doing this in your case here? It seems like it would be easier to just pass the WiredGoPro instance to wherever it is needed.

@tcamise-gpsw tcamise-gpsw added feedback requested Further information is requested python sdk Python SDK question A discussion / question. Not sure if bug or enhancement. and removed demos Relating to demos (not SDKs) labels Jan 7, 2025
@github-project-automation github-project-automation bot moved this to To do in Python SDK Jan 8, 2025
@tcamise-gpsw tcamise-gpsw moved this from To do to In progress in Python SDK Jan 8, 2025
@tcamise-gpsw tcamise-gpsw moved this from In progress to Waiting for Feedback in Python SDK Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback requested Further information is requested python sdk Python SDK question A discussion / question. Not sure if bug or enhancement.
Projects
Status: Waiting for Feedback
Development

No branches or pull requests

3 participants