【问题标题】:Opening ipython from sublime text从崇高的文本打开 ipython
【发布时间】:2013-09-12 21:48:08
【问题描述】:

我在 sublime text 2 中添加了以下插件,用于打开 ipython qt 控制台:

import sublime, sublime_plugin
from subprocess import call
# import os

class ipythonQtCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        call(["start","ipython", "qtconsole", "--pylab", "--ConsoleWidget.font_size=9", "--ConsoleWidget.font_family='Consolas'"],shell=True)

最初它工作得很好,即插件打开了一个 ipython shell。然后我添加了一个菜单项和一个键绑定。在某些时候一定出了问题,因为现在我在运行插件时遇到了这个错误:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Chris\Python27\lib\site-packages\IPython\__init__.py", line 43, in <
odule>
    from .config.loader import Config
  File "C:\Chris\Python27\lib\site-packages\IPython\config\__init__.py", line 1
, in <module>
    from .application import *
  File "C:\Chris\Python27\lib\site-packages\IPython\config\application.py", lin
 31, in <module>
    from IPython.config.configurable import SingletonConfigurable
  File "C:\Chris\Python27\lib\site-packages\IPython\config\configurable.py", li
e 31, in <module>
    from loader import Config
  File "C:\Chris\Python27\lib\site-packages\IPython\config\loader.py", line 32,
in <module>
    from IPython.utils.path import filefind, get_ipython_dir
  File "C:\Chris\Python27\lib\site-packages\IPython\utils\path.py", line 29, in
<module>
    from IPython.utils.process import system
  File "C:\Chris\Python27\lib\site-packages\IPython\utils\process.py", line 25,
in <module>
    from ._process_win32 import _find_cmd, system, getoutput, AvoidUNCPath, arg
split
  File "C:\Chris\Python27\lib\site-packages\IPython\utils\_process_win32.py", l
ne 21, in <module>
    import ctypes
  File "C:\Chris\Python27\lib\ctypes\__init__.py", line 10, in <module>
    from _ctypes import Union, Structure, Array
ImportError: Module use of python26.dll conflicts with this version of Python.

我通过在 st2 shell 本身中逐行运行脚本来测试脚本,它是导致错误的最后一行 call([...])。我觉得这有点奇怪,因为从其他地方调用它时该命令可以正常工作,例如ipython 本身。

【问题讨论】:

  • This 问题可能是相关的,但是我在 Windows 7/8 上并且不太确定软链接的等价物是什么。我也在使用便携式 st2 版本(记录在案……不确定这是否重要)

标签: python plugins sublimetext2


【解决方案1】:

好像和st2原生的python有冲突。无论如何,当使用os.chdir() 更改工作目录时,我设法让os.system(...) 工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-14
    • 1970-01-01
    • 1970-01-01
    • 2020-08-21
    • 1970-01-01
    • 2013-04-12
    相关资源
    最近更新 更多