Pyramid v2.0 Quick Tutorial has stopped working

22 views
Skip to first unread message

Brady Kelly

unread,
Sep 4, 2021, 4:18:34 PM9/4/21
to pylons-discuss
I followed the official Quick Tutorial for Pyramid, up until Step 9: Organizing Views With View Classes. I meticulously followed a similar pattern of instructions for most steps:

- Copy the previous step's code to the new step - a new project with a Python package called "tutorial".
- Install requirements for the new project using "pip install -e ."
- Change the code from the previous step
- Change the tests from the previous step
- Run the new project with "pserve development.ini --reload"

I finished the View Classes step and the tests passed, and the app ran properly, as expected. I then took a break, during which my PC crashed and restarted. 

I then took up the tutorial on Step 10: Handling Web Requests and Responses, and followed all the above steps, just as I have successfully followed them for each previous step. I changed the code and tests, and the new tests pass, but when I try and run my app with "pserve development.ini --reload", a message gets printed:

Starting monitor for PID 16628.

Followed by a long traceback that ends with:

ModuleNotFoundError: No module named 'tutorial'
Press ENTER or change a file to reload

Now when I try and run the code for any of the tutorial's previous steps, that all worked before, I get the same error. This doesn't look like a simple missing package, because the package is present in the tutorial step's code, and all 5 unit and functional tests pass. What could be wrong that the code that 'pserve' runs can't find a 'tutorial' package?

Thank you

Steve Piercy

unread,
Sep 4, 2021, 4:26:05 PM9/4/21
to pylons-discuss
After your PC crashed, in your shell session did you also add the environment variable for the path to your virtual environment or activate the correct virtual environment?


There might be some other one-time steps at the start of the tutorial that need to be performed.

Please paste the traceback, too.

--steve

Brady Kelly

unread,
Sep 4, 2021, 4:41:46 PM9/4/21
to pylons-discuss
Yes, I set the environment variable PYRENV to  D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV  and was able to use that variable in my cmd commands to activate the virtual environment, and to run %PYRENV%\Scripts\pip install -e . which seemed to run correctly. I also use the environment variable to run the project with  %PYRENV%\Scripts\pserve development.ini --reload. 

The Traceback is:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\hupper\ipc.py", line 319, in 
spawn_main
    func(**kwargs)
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\hupper\worker.py", line 252, 
in worker_main
    func(*spec_args, **spec_kwargs)
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\pyramid\scripts\pserve.py", line 30, in main
    return command.run()
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\pyramid\scripts\pserve.py", line 271, in run
    app = loader.get_wsgi_app(app_name, config_vars)
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\plaster_pastedeploy\__init__.py", line 125, in get_wsgi_app
    return loadapp(
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\paste\deploy\loadwsgi.py", line 253, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\paste\deploy\loadwsgi.py", line 275, in loadobj
    context = loadcontext(
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\paste\deploy\loadwsgi.py", line 299, in loadcontext
    return _loaders[scheme](
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\paste\deploy\loadwsgi.py", line 326, in _loadconfig
    return loader.get_context(object_type, name, global_conf)
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\paste\deploy\loadwsgi.py", line 457, in get_context
    context = self._context_from_use(
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\paste\deploy\loadwsgi.py", line 480, in _context_from_use
    context = self.get_context(
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\paste\deploy\loadwsgi.py", line 410, in get_context
    return loadcontext(object_type, name,
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\paste\deploy\loadwsgi.py", line 299, in loadcontext
    return _loaders[scheme](
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\paste\deploy\loadwsgi.py", line 334, in _loadegg
    return loader.get_context(object_type, name, global_conf)
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\paste\deploy\loadwsgi.py", line 624, in get_context
    entry_point, protocol, ep_name = self.find_egg_entry_point(
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\paste\deploy\loadwsgi.py", line 651, in find_egg_entry_point
    possible.append((entry.load(), protocol, entry.name))
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\pkg_resources\__init__.py", line 2450, in load
    return self.resolve()
  File "D:\Personal\PythonProjects\Pyramid\projects\quick_tutorial\ENV\lib\site-packages\pkg_resources\__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'tutorial'
Press ENTER or change a file to reload.


Brady Kelly

unread,
Sep 4, 2021, 4:52:32 PM9/4/21
to pylons-discuss
My apologies. Somewhere between running pip install -e . and trying to run my project I had lost my environment variable. All seems fine now - thank you very much.

On Saturday, 4 September 2021 at 22:26:05 UTC+2 Steve Piercy wrote:
Reply all
Reply to author
Forward
0 new messages