当前位置:首页 > 操作系统 > MacOs

python – 执行具有“from __future__ import …”的AquaMacs缓冲区

运行AquaEmacs,我想在Python中执行缓冲区(C-c C-c).

缓冲区以:

<code>from __future__ import print_function
</code>

AquaEmacs中的执行始于:

<code>import sys,imp
if'test_one_liners' in sys.modules:
   imp.reload(test_one_liners)
else:
   import test_one_liners
</code>

其中test_one_liners.py是我的文件.这给出了这个错误:

<code> SyntaxError: from __future__ imports must occur at the beginning of the file
</code>

有谁知道在哪里以及如何解决这个问题?

让我再次添加信息以表明清楚.

创建此缓冲区:

<code> from __future__ import print_function

 print("Hello")
</code>

使用文件/更改缓冲模式/ Python使Python和C-c C-c执行它;它不需要保存.缓冲区被写入某个临时文件并因SyntaxError而失败:from __future__ imports必须出现在文件的开头.回溯包括生成的文件,其中包含对临时文件的引用.怎么会发生打印你好.

解决方法:

这是python-mode.el中的一个错误,它在当前版本中得到修复.看起来像aquamacs与older version of python-mode.el捆绑在一起.

错误报告在这里:bug #1063884和修复here.

你应该更新你的python-mode.el包.


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐