[Python] Visual Studio Code pylint: Unable to import 'protorpc'

Discussão em 'Python' iniciado por Stack, Junho 25, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using pylint in Visual Studio Code to develop a Google App Engine (GAE) Cloud Endpoint API in Python. I'm unable to resolve a lint error. I don't know what's causing the error, but at a guess, pylint cannot find the protorpc library?

    [​IMG]

    The recommended fix in Troubleshooting Linting is to configure workspace settings to point to fully qualified python executable. I have done this, but the lint error remains.

    [​IMG]

    protorpc itself is installed to:

    ~/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc


    ...and this contains the remote.py module that cannot be imported:

    __init__.py generate_python.py protojson.py transport.py
    definition.py google_imports.py protourlencode.py util.py
    descriptor.py message_types.py registry.py webapp
    generate.py messages.py remote.py wsgi
    generate_proto.py protobuf.py static


    I've added this path to $PYTHONPATH (along with the kitchen sink):

    export GOOGLE_CLOUD_SDK=~/google-cloud-sdk
    export APPENGINE_PATH=$GOOGLE_CLOUD_SDK/platform/google_appengine

    export PYTHONPATH=$PYTHONPATH:$GOOGLE_CLOUD_SDK
    export PYTHONPATH=$PYTHONPATH:$GOOGLE_CLOUD_SDK/lib
    export PYTHONPATH=$PYTHONPATH:$GOOGLE_CLOUD_SDK/lib/googlecloudsdk
    export PYTHONPATH=$PYTHONPATH:$GOOGLE_CLOUD_SDK/lib/googlecloudsdk/api_lib
    export PYTHONPATH=$PYTHONPATH:$GOOGLE_CLOUD_SDK/platform/google_appengine/lib
    export PYTHONPATH=$PYTHONPATH:$GOOGLE_CLOUD_SDK/platform/google_appengine/lib/protorpc-1.0/protorpc


    The application runs locally and also when deployed, so this appears to be just a lint error, but it's frustrating that I can't solve it.

    Using third-party libraries states:


    The Python runtime in the standard environment includes the Python standard library, the App Engine libraries, and a few bundled third-party packages.
    ​

    Because of this, I assumed 'the App Engine libraries' includes protorpc, but I'm unsure. Moreover, Adding the Cloud Endpoints Frameworks library to the sample API only requires google-endpoints be installed to the app's lib directory:

    pip install -t lib google-endpoints --extra-index-url=https://gapi-pypi.appspot.com/admin/nurpc-dev --ignore-installed


    My point is, I don't think I've not installed something, and I don't think I'm missing anything in my (web) app's lib directory.

    Continue reading...

Compartilhe esta Página