[Python] CodeQl : could not resolve module python problem

Discussão em 'Python' iniciado por Stack, Novembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to run a simple code ql command on my vscode. but when i try to execute this program:

    import python

    from File f
    where f.getFileExtension() = "py"
    select f, "Fichier Python analysé"



    there is an error indicating this :

    Failed to run query:
    ERROR: could not resolve module python (H:\Desktop\Codeql\test.ql:1,8-14)
    ERROR: could not resolve type File (H:\Desktop\Codeql\test.ql:3,6-10


    I dowloaded the database before executing the query with this command :

    codeql database create database --language=python --overwrite


    My codeql runs well when I type codeql --version:

    PS H:\Desktop\Codeql> codeql --version
    CodeQL command-line toolchain release 2.19.3.
    Copyright (C) 2019-2024 GitHub, Inc.
    Unpacked in: h:\Desktop\codeql-win64\codeql
    Analysis results depend critically on separately distributed query and
    extractor modules. To list modules that are visible to the toolchain,
    use 'codeql resolve packs' and 'codeql resolve languages'.
    PS H:\Desktop\Codeql> codeql resolve languages
    cpp (h:\Desktop\codeql-win64\codeql\cpp)
    csharp (h:\Desktop\codeql-win64\codeql\csharp)
    csv (h:\Desktop\codeql-win64\codeql\csv)
    go (h:\Desktop\codeql-win64\codeql\go)
    html (h:\Desktop\codeql-win64\codeql\html)
    java (h:\Desktop\codeql-win64\codeql\java)
    javascript (h:\Desktop\codeql-win64\codeql\javascript)
    properties (h:\Desktop\codeql-win64\codeql\properties)
    python (h:\Desktop\codeql-win64\codeql\python)
    ruby (h:\Desktop\codeql-win64\codeql\ruby)
    swift (h:\Desktop\codeql-win64\codeql\swift)
    xml (h:\Desktop\codeql-win64\codeql\xml)
    yaml (h:\Desktop\codeql-win64\codeql\yaml)


    I don't know how to solve the problem.

    I am expecting this program to run correctly, I have installed and uninstalled codeql on this site, downloading the codeql-wi64 version. I added the paths correctly ( I am using windows but even on my linux it doesn't work )

    Continue reading...

Compartilhe esta Página