Wild guess: Different default directory.
Try setting PYTHONPATH, or add "os.chdir('some/dir')" to top of script...
On 08/24/2017 10:33 PM, Cheng-Hung Hsueh wrote:
It is a python script `|tshi3.py|` :
|
在此輸入代碼...
|importcsv defli2ho2():print(csv) li2ho2()|
|
I copied this code and pasted it in |`python manage.py shell|`. It works.
But I ran `|python manage.py shell < tshi3.py|`. Got |`NameError: name
'csv' is not defined|.`
Why?
Enviroment:
|
在此輸入代碼...
|LinuxMint18.1Python3.4.1(default,Sep32014,08:45:22)Django==1.11.4|
|
--
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 django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/7466c326-0f03-4299-9239-1126daf24aaf%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/7466c326-0f03-4299-9239-1126daf24aaf%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/b1944651-6a10-cfcc-f555-9ba7e5460797%40musicplace.com.
For more options, visit https://groups.google.com/d/optout.