You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As stated in #3885 and #3761, given the use of notebooks for the documentation, users may encounter errors if they try to use the code as-is in a Python file. This is because notebooks support top-level await statements, while Python files do not (without wrapping them in an async function).
When I need to use a .py file, I typically copy each code block from the notebook and wrap await statements inside an async function.
One proposal to improve this could be to include the full code from the notebook inside a dropdown at the bottom of the notebook.
```{dropdown} Full Code
:icon: code
```python
# Here goes the full code
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
As stated in #3885 and #3761, given the use of notebooks for the documentation, users may encounter errors if they try to use the code as-is in a Python file. This is because notebooks support top-level
await
statements, while Python files do not (without wrapping them in anasync
function).When I need to use a
.py
file, I typically copy each code block from the notebook and wrapawait
statements inside anasync
function.One proposal to improve this could be to include the full code from the notebook inside a dropdown at the bottom of the notebook.
Block of code with a handy copy button!
Beta Was this translation helpful? Give feedback.
All reactions