Skip to content

Prospector gets file paths wrong #199

Closed

Description

From Florian Beijers (@zersiax) on October 9, 2017 22:17

Environment data

VS Code version: Latest Insider as of now
Python Extension version: Latest version available in Marketplace
Python Version: 3.6
OS and version: Windows 10 build 16299

Actual behavior

In my problems view, I'm seeing errors about "no module named" followed by the path to the current file I'm in, e.g., c:\users\name\project\app\views.py). However, this code runs fine using the same Python context and gives no such errors.

Expected behavior

I shouldn't see these errors since they aren't errors.

Steps to reproduce:

  • (going to list everything I did, not sure what parts are relevant)
  1. Create a new Django project in the home folder of WSL (Windows Subsystem for Linux).
  2. Realize you can't reach that filesystem from Vs Code and copy the folder to your Windows home folder, e.g. c:\users\name\dev.
  3. Open the project in Visual Studio Code. Note that we're not using a virtual environment. One was created, but in WSL so it would be Linux-based and probably not useful to the Windows host. It is, however, present in the copied folder in my case, although it is not being used. Autopep8, prospector and Django 1.11 are installed to the global context using pip.
  4. Open any given file, settings.py is fine.
  5. At this point, I am already getting this error by Prospector about no module name ....../settings.py.
  6. I tried feeding --uses django into the ProspectorArgs array in settings.json but this didn't fix the issue.

Copied from original issue: DonJayamanne/pythonVSCode#1289

Activity

  1. DonJayamanne commented on Nov 14, 2017

    @DonJayamanne
    Author

    Unfortulately WSL isn't supported at this stage.
    https://github.com/DonJayamanne/pythonVSCode/issues/534

  2. DonJayamanne commented on Nov 14, 2017

    @DonJayamanne
    Author

    Hopefully this will be resolved soon. Please follow the #534 for updates.

  3. DonJayamanne commented on Nov 14, 2017

    @DonJayamanne
    Author

    From Florian Beijers (@zersiax) on October 10, 2017 10:9

    Don Jayamanne (@DonJayamanne) From step 2 in my reproduce steps, WSL is completely out of the picture, so I don't think this is a WSL issue?

  4. DonJayamanne commented on Nov 14, 2017

    @DonJayamanne
    Author

    What's the path to your python virtual environment?
    Please ensure this is configured in your workspace settings (settings.json), i.e. the setting python.pythonPath needs to point to the python interpreter you are working on.

  5. DonJayamanne commented on Nov 14, 2017

    @DonJayamanne
    Author

    From Florian Beijers (@zersiax) on October 10, 2017 18:29

    Python I'm working on is my Windows OS's global python install, which is added to the OS PATH environment variable. Wouldn't the extension pick it up at that point?

  6. DonJayamanne commented on Nov 14, 2017

    @DonJayamanne
    Author

    Yes it would.

  7. changed the title [-]Extension with Prospector linting gives false positives[/-] [+]Prospector gets file paths wrong[/+] on Jan 11, 2018
  8. brettcannon commented on Jan 11, 2018

    @brettcannon
    Member

    For some reason Prospector is passing into Pylint the file's path with the directory structured duplicated, e.g. c:\a\b\c\d.py as c:\a\b\c\a\b\c\d.py.
    Output:

    #######Linting Output - prospector##########
    {
      "summary": {
        "started": "2018-01-11 14:55:40.524661",
        "libraries": [],
        "strictness": null,
        "profiles": "default, no_doc_warnings, no_test_warnings, strictness_medium, strictness_high, strictness_veryhigh, no_member_warnings",
        "tools": [
          "dodgy",
          "mccabe",
          "pep8",
          "profile-validator",
          "pyflakes",
          "pylint"
        ],
        "message_count": 2,
        "completed": "2018-01-11 14:55:41.418668",
        "time_taken": "0.89",
        "formatter": "json"
      },
      "messages": [
        {
          "source": "pylint",
          "code": "syntax-error",
          "location": {
            "path": "c:\\Users\\brcan\\Desktop\\bunk\\tester.py",
            "module": "tester",
            "function": null,
            "line": 5,
            "character": 0
          },
          "message": "invalid syntax (<string>, line 5)"
        },
        {
          "source": "pylint",
          "code": "fatal",
          "location": {
            "path": "c:\\Users\\brcan\\Desktop\\bunk\\Users\\brcan\\Desktop\\bunk\\tester.py",
            "module": "c:\\Users\\brcan\\Desktop\\bunk\\Users\\brcan\\Desktop\\bunk\\tester.py",
            "function": null,
            "line": 1,
            "character": 0
          },
          "message": "No module named Users\\brcan\\Desktop\\bunk\\tester.py"
        }
      ]
    }
  9. ericsnowcurrently commented on Mar 7, 2018

    @ericsnowcurrently

    I'm seeing a similar issue (on linux). With prospector enabled everything appears to work. However, the first message for each file is similar to the following:

    [prospector - pylint] fatal:No module named home/<user>/<pkg>/spam.py
    

    Two things to note:

    • the path has no leading slash
    • if I have linting failures in a file then it reports them correctly, even though it also reports the above fatal error

    I'm not seeing any duplication in the reported path.

  10. added a commit that references this issue on Mar 22, 2018
    60fec3a
  11. locked as resolved and limited conversation to collaborators on Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-lintingbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions