Skip to content

ipython shell in django 3.0 results in SynchronousOnlyOperation #12593

Open
@simondrabble

Description

@simondrabble

Versions:

ipython==7.18.1
Django==3.0.5
python==3.8

If I run the following code using regular non-ipython django shell:

[x.scheduled_date for x in MyModel.objects.all()]

All is well and I see the list of scheduled dates. If I do the same using ipython, I get:

SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.

I can run the following without error in both environments:

for x in MyModel.objects.all():
    print(x.scheduled_date)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions