【问题标题】:Hide unresolved import error隐藏未解决的导入错误
【发布时间】:2012-01-16 04:21:53
【问题描述】:

我使用适用于 Eclipse 的 Python 插件:Linux 上的 PyDev,我正在编写一个跨平台应用程序。

在这个应用程序中,我有以下几行代码:

try :
    from win32com.shell import shellcon, shell
    appdata_path = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0)
except :
    appdata_path = os.environ['APPDATA']

PyDev 显示 2 个错误:

Unresolved import: shell
Unresolved import: shellcon

出现这些错误是因为我的系统上没有安装pywin32 扩展,我无法安装它,因为有 windows 扩展,而不是 linux。

是否有办法隐藏或忽略(仅)这些错误?

谢谢

【问题讨论】:

    标签: python eclipse pydev


    【解决方案1】:

    在失败的导入行上单击 Ctl + 1 并选择 @UnresolvedImport 错误

    或手动,像这样:

    import Afailure #@UnresolvedImport
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-09
      • 1970-01-01
      • 2016-10-12
      • 2012-10-06
      • 2012-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多