Reputation: 3
I am new to django and am starting to go through the documenation and the poll tutorial. Install etc has been no problem and I have gotten as far as creating and activating the simple model however I am now trying to invoke the Python shell using
python manage.py shell
but I keep getting the below error each time.
C:\Users\Owner\Desktop\Programming\Djang\mysite>python manage.py shell
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\python27\lib\site-packages\django\core\management\__init__.py", line
399, in execute_from_command_line
utility.execute()
File "C:\python27\lib\site-packages\django\core\management\__init__.py", line
392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\python27\lib\site-packages\django\core\management\base.py", line 242,
in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\python27\lib\site-packages\django\core\management\base.py", line 285,
in execute
output = self.handle(*args, **options)
File "C:\python27\lib\site-packages\django\core\management\base.py", line 415,
in handle
return self.handle_noargs(**options)
File "C:\python27\lib\site-packages\django\core\management\commands\shell.py",
line 81, in handle_noargs
self.run_shell(shell=interface)
File "C:\python27\lib\site-packages\django\core\management\commands\shell.py",
line 61, in run_shell
return getattr(self, shell)()
File "C:\python27\lib\site-packages\django\core\management\commands\shell.py",
line 44, in ipython
ip()
File "C:\python27\lib\site-packages\django\core\management\commands\shell.py",
line 37, in _ipython
from IPython import start_ipython
File "C:\python27\lib\site-packages\IPython\__init__.py", line 43, in <module>
from .config.loader import Config
File "C:\python27\lib\site-packages\IPython\config\__init__.py", line 16, in <
module>
from .application import *
File "C:\python27\lib\site-packages\IPython\config\application.py", line 29, i
n <module>
from IPython.external.decorator import decorator
File "C:\python27\lib\site-packages\IPython\external\decorator\__init__.py", l
ine 4, in <module>
from ._decorator import *
File "C:\python27\lib\site-packages\IPython\external\decorator\_decorator.py",
line 165
print('Error in generated code:', file=sys.stderr)
^
SyntaxError: invalid syntax
Thanks in advance for any help on this as although I have some experience in Python I'm finding it very hard to follow the Traceback above.
Upvotes: 0
Views: 231
Reputation: 36141
You are using a Python 3 library (and not backward compatible) with the Python 2.7 version. You need either to reinstall ipython
for Python 2 (in C:\python27
) or upgrade to Python 3 (and install ipython
in C:\python3
)
Django is officially compatible with Python 3 since the 1.6 version.
Upvotes: 1