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 · 2 comments
Open
Labels
triage Needs to be reviewed and assigned

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())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs to be reviewed and assigned
Projects
None yet
Development

No branches or pull requests

2 participants