在导入其它文件夹中py文件的时候,即使在代码中添加了指定路径,由于Pylint 无法检测到该文件,会给出Unable to import 'xxx'的错误提示

需要在项目目录下添加.pylintrc文件指定要引用文件所在的目录

# .pylintrc 文件用于为pllint进行自定义配置

[MASTER]
# XXX 应被替换为你指定的文件夹如(./custom_lib)
init-hook='base_dir="XXX"; import sys,os,re; _re=re.search(r".+\/" + base_dir, os.getcwd()); project_dir = _re.group() if _re else os.path.join(os.getcwd(), base_dir); sys.path.append(project_dir)' [MESSAGES CONTROL]
# Find available symbolic names in:
# https://docs.pylint.org/features.html
disable=locally-disabled,trailing-whitespace,fixme,missing-docstring,protected-access,invalid-name,super-init-not-called,star-args,no-self-argument,inherit-non-class,no-method-argument,no-self-use,unused-argument,too-many-return-statements,too-many-branches,too-many-function-args,too-many-instance-attributes,too-many-locals,bad-continuation,unnecessary-lambda,redefined-variable-type,global-statement,line-too-long,mixed-indentation,bad-whitespace,missing-final-newline

vscode中PyLint报错Unable to import解决方案的更多相关文章

  1. 导入spark程序的maven依赖包时,无法导入,报错Unable to import maven project: See logs for details

    问题:导入spark程序的maven依赖包时,无法导入,且报错:0:23 Unable to import maven project: See logs for details 2019-08-23 ...

  2. python安装numpy、scipy、gensim以及报错unable to import 'smart_open.gcs', disabling that module处理

    首先,安装gensim库,必须先安装numpy+mkl和scipy 安装顺序是依次安装numpy+kml.scipy.gensim,根据自己Python下载的版本进行下载 如果你的库里面有numpy. ...

  3. [RN] React Native 使用 react-navigation 报错 "Unable to resolve module `react-native-gesture-handler`

    在React Native 使用 react-navigation 过程中,报错 "Unable to resolve module `react-native-gesture-handle ...

  4. iOS-C文件添加到iOS项目中,运行报错

    iOS-C文件添加到iOS项目中,运行报错 问题: 往项目中添加一个空的c文件, 编译运行; 出现2,30个编译错误. 原因: 由于在项目中添加了Pch文件,在文件中所有代码还没有开始运行之前, pc ...

  5. AS添加依赖报错Unable to merge dex

    AS添加依赖报错Unable to merge dex 最近在给项目添加依赖的时候,要给项目导入Bmob的SDK,参照Bmob的官方文档,可以直接在app的build.gradle文件中添加 //Bm ...

  6. Python3.x:关于urllib中urlopen报错问题的解决方案

    Python3.x:关于urllib中urlopen报错问题的解决方案 调用:urllib.urlopen(url) 报错:AttributeError: 'module' object has no ...

  7. 单点登录(十一)-----遇到问题-----cas启用mongodb验证方式报错--Unable to locate Spring NamespaceHandler for XML schema na

    cas启用mongodb验证方式报错--Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.sp ...

  8. selenium+phantomjs报错:Unable to find a free port的分析和解决

    selenium+phantomjs报错:Unable to find a free port的分析和解决 Table of Contents 1. 现象 2. 分析 3. 解决办法 1 现象 在做项 ...

  9. jpa报错 Unable to acquire a connection from driver [null], user [null] and URL [null]

    jpa报错 Unable to acquire a connection from driver [null], user [null] and URL [null] 为啥报错 因为你在persist ...

随机推荐

  1. BZOJ [FJOI2007]轮状病毒 (找规律)

    1002: [FJOI2007]轮状病毒 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 6009  Solved: 3282[Submit][Statu ...

  2. spring mvc 文件上传工具类

    虽然文件上传在框架中,已经不是什么困难的事情了,但自己还是开发了一个文件上传工具类,是基于springmvc文件上传的. 工具类只需要传入需要的两个参数,就可以上传到任何想要上传的路径: 参数1:Ht ...

  3. embeded_2_separate_sync

    //如果是8位的话,只选择低8位传输 //因为同步码也是可以自己设置,所以把同步码设置成parameter最好 module embeded_2_separate_sync( input clk, : ...

  4. 关于css中设置属性的常识

    1.cellspacing 属性规定单元格之间的空间,请勿将该属性与 cellpadding 属性相混淆. 2.cellpadding 属性规定的是单元边沿与单元内容之间的空间. 3.text-ali ...

  5. HDU 1003 MAXSUM(最大子序列和)

    Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub ...

  6. C语言实现BMP图片生成

    ## #include <stdio.h> #include <stdlib.h> #include <string.h> typedef unsigned cha ...

  7. MIT Molecular Biology 笔记1 DNA的复制,染色体组装

    视频  https://www.bilibili.com/video/av7973580?from=search&seid=16993146754254492690 教材 Molecular ...

  8. loadrunner实战篇 - 客户关系管理系统性能测试

    系统介绍                                                             图1(客户关系管理系统模块关系图) 需求分析 一.性能指标 性能指标分 ...

  9. SignalR 2 入门

    在本教程中使用的软件版本 Visual Studio 2015 .NET 4.5 SignalR 版本 2 概述 本教程介绍了通过演示如何生成简单的基于浏览器的聊天应用程序的 SignalR 开发. ...

  10. 关于ubuntu软件卸载的问题

    ...... 起因很菜....就是手贱把/usr/lib/下的R的目录给rm -rf掉了, 然后在R的软件包里用./configure也生不成, R RHOME还在, 然而因为lib下的R删掉了所以R ...