Django的manage.py shell不会缩进
我似乎遇到了一个奇怪的错误,或更可能是我的系统上的一些我不熟悉的设置,当我在 Django 的 shell 中时不允许我进行制表(python manage.py shell
是我的方式)运行它)。
由于显而易见的原因,这被证明很烦人,因为我无法在 shell 中执行任何循环或条件。如果我点击 tab 它就会完成我可以使用的所有功能,就像 bash 在终端中所做的那样。我尝试过仅使用空格作为缩进,但总是出现缩进错误。
有谁知道为什么会发生这种情况以及我可以做些什么来让 tab 再次在我的 shell 中工作? (可能需要知道这是在 Ubuntu 9.04 系统上)。
编辑: tab 在常规 pythong shell 中工作正常,只有在 django 中则不然。
谢谢。
I seem to have run into a strange bug or more likely some setting I am unfamiliar with on my system that is not allowing me to tab when I am in Django's shell (python manage.py shell
is how I run it).
For obvious reasons this is proving to be annoying since I can't do any loops or conditonals in the shell. If I hit tab it completes all functions that are available to me, like bash does in a terminal. I've tried just using spaces for my indents but I always get an indentation error.
Does anyone know why this is happening and what I can do to get tab to work in my shell again? (It may be relevant to know that this is on a Ubuntu 9.04 system).
Edit: tab works fine in the regular pythong shell, it's only in django's that it doesn't.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜通常当你运行
python
时,它会调用类似ipython
的东西,因为普通的股票解释器不执行制表符补全。它 应该自动选择 ipython 并使用它 。尝试启动一个普通的Python解释器(只需在命令行运行python
)并运行如果你能做到这一点,
manage.py
应该使用ipython。如果没有,可能需要重新安装 ipython,因为看起来IPython
模块没有正确安装。I'm guessing normally when you run
python
it's invoking something likeipython
instead because the normal stock interpreter does not do tab-completion. It should pick up ipython automatically and use it, though. Try firing up a plain python interpreter (just runpython
at the command line) and runningIf you can do that,
manage.py
should use ipython. If not, maybe reinstall ipython as it would appear that theIPython
module didn't get properly installed.