Skip to content

Commit

Permalink
Merge pull request #930 from marceloneppel/fix-asyncio-on-readme
Browse files Browse the repository at this point in the history
#930

#### Description

The following error is thrown if we run the example code from README.
```sh
Traceback (most recent call last):
 File "/home/ubuntu/main.py", line 6, in <module>
 from juju import asyncio
ImportError: cannot import name 'asyncio' from 'juju' (/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.11.4_1/lib/python3.11/site-packages/juju/__init__.py)
```

It fails because it should be using `jasyncio`, which is the correct module to import. The the other examples from the `examples` folder are using the correct module.

#### QA Steps

Add the code from README to a file named `main.py` and run it with `python3 main.py`. The ubuntu charm should be correctly deployed.
  • Loading branch information
jujubot authored Aug 7, 2023
2 parents fbf2f62 + 198a5de commit 7708429
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Pylibjuju requires an already bootstrapped Juju controller to connect to.
import logging
import sys
from juju import asyncio
from juju import jasyncio
from juju.model import Model
Expand Down Expand Up @@ -89,7 +89,7 @@ Pylibjuju requires an already bootstrapped Juju controller to connect to.
# Run the deploy coroutine in an asyncio event loop, using a helper
# that abstracts loop creation and teardown.
asyncio.run(deploy())
jasyncio.run(deploy())
if __name__ == '__main__':
Expand Down

0 comments on commit 7708429

Please sign in to comment.