← 输入框|github.com|刷新
Skip to content

Error loading the plugin when there is a python file in directory whose name clashes with the dependencies #1156

Open

Description

@dagcilibili

Hi, I was getting the Error detected while processing .../pymode/lint.vim, and looked at the troubleshooting steps which did not resolve the issue (rightfully so); so I looked into the root cause a bit. I realized that, in this case (which, I believe can happen to many), the call from pylama.lint.extensions import LINTERS that pymode/lint.vim does eventually tries to load a python module named "io". However, there is a file named as io.py in the directory I am calling vim from, so the names for the modules clash, and I get an error. Is there a way to setup pymode or vim so that it is robust to this edge case? Thank you very much!

Activity

  1. Drachenfels commented on Feb 17, 2023

    @Drachenfels

    It's related to pythonpath and fixing it on a side of python-mode is near impossible or would include some hardcore hacking in form of adding/removing stuff to sys.path and etc).

    But there is probably an easy fix for you, relative import: from . import io will fix it, that is the reason why it's recommended to perform 'import X.Y' only on stdlib modules.

    An alternative solution for you would be to use flags of interpret like perhaps: python -P app.py or python -I app.py, this however I doubt would help you or would introduce tons of other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions