Search code examples
pythonpycharmuwsgiwsgipyramid

Could not find a matching loader for the scheme "file+ini ", protocol "wsgi" when running a Pyramid project in PyCharm (Professional version)


I got an error about 'could not find a matching loader for the scheme' when I want to run my Pyramid web app in PyCharm based on Pyramid server. However, if I directly run pserve myapp.ini in terminal, it can launch my web app locally. I have edit the configuration in PyCharm: the config file is pointed to myapp.ini and the Python interpreter is pointed to python in the virtual environment.

Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/pycharm_load_entry_point.py", line 12, in sys.exit(f()) File "/Users/simon/Documents/venv/lib/python3.6/site-packages/pyramid/scripts/pserve.py", line 34, in main return command.run() File "/Users/simon/Documents/venv/lib/python3.6/site-packages/pyramid/scripts/pserve.py", line 193, in run loader = self._get_config_loader(config_uri) File "/Users/simon/Documents/venv/lib/python3.6/site-packages/pyramid/scripts/common.py", line 23, in get_config_loader return plaster.get_loader(config_uri, protocols=['wsgi']) File "/Users/simon/Documents/venv/lib/python3.6/site-packages/plaster/loaders.py", line 109, in get_loader raise LoaderNotFound(requested_scheme, protocols=protocols) plaster.exceptions.LoaderNotFound: Could not find a matching loader for the scheme "file+ini ", protocol "wsgi".

Process finished with exit code 1

Though I go to the official website about plaster and WSGI, I still cannot figure it out.

Do anyone have any suggestion or have any similar problem when configuring Pyramid web app in PyCharm?

Thanks.


Solution

  • Ensure that you have entered all the required values in a Run/Debug Configuration.

    https://www.jetbrains.com/help/pycharm/run-debug-configuration.html#create-permanent

    Create a run/debug configuration from a template

    1. Open the Run/Debug Configuration dialog in one of the following ways:

      • Select Run | Edit Configurations from the main menu.

      • With the Navigation bar visible (View | Appearance | Navigation Bar), choose Edit Configurations from the run/debug configuration selector.

      • Press ⌃⌥R and then press 0.

    2. In the Run/Debug Configuration dialog, click + on the toolbar or press ⌘N. The list shows the run/debug configuration templates.

      Select the desired template. If you are not sure which template to choose, refer to Run/debug configurations dialog for more information on particular templates.

      Run/Debug Configurations

    3. Specify the run/debug configuration name in the Name field. This name will be shown in the list of the available run/debug configurations.

    4. [Omitted]

    5. Set the run/debug configuration parameters.

    The required parameters for a Pyramid project* include Name, Config file, Project, Python interpreter, and Working directory. You needed to add Working directory.

    * I don't know why they call it a "Pyramid server". Pyramid is a web framework, not a server. Waitress and Werkzeug are servers.