On Thu, Apr 21, 2022 at 1:06 PM [email protected] <[email protected]> wrote: > > Why does this fail?... > > % echo "import datetime ; [datetime for e in [1, 2]]" > test > > % ./manage.py shell < test > > Traceback (most recent call last): > File "./manage.py", line 8, in <module> > django.core.management.execute_from_command_line(sys.argv) > File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", > line 381, in execute_from_command_line > utility.execute() > File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", > line 375, in execute > self.fetch_command(subcommand).run_from_argv(self.argv) > File "/usr/lib/python3/dist-packages/django/core/management/base.py", line > 323, in run_from_argv > self.execute(*args, **cmd_options) > File "/usr/lib/python3/dist-packages/django/core/management/base.py", line > 364, in execute > output = self.handle(*args, **options) > File > "/usr/lib/python3/dist-packages/django/core/management/commands/shell.py", > line 92, in handle > exec(sys.stdin.read()) > File "<string>", line 1, in <module> > File "<string>", line 1, in <listcomp> > NameError: name 'datetime' is not defined
What do you expect to happen? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACwCsY4%3D5kn5_ka%3DvDxXyt5P8cNWvEmHHg2%2BtWTUzNcRSWcHhg%40mail.gmail.com.

