Stuck on LP3THW ex46 ... maybe?

For some reason I’ve gotten pretty confused trying to do this one. I’ve gone through the text multiple times, and through the video 3 times (since I couldn’t completely get the work done on the text alone). It’s actually been hard even putting words to my challenges with this and properly describing my setup, but I’ve persisted for this long (about 8 hours over 4 days) …

I think I have 2 remaining questions:

  1. Using Windows 10, I do get the “\skeleton” directory and daughter folders described on page 233 (although I had to move a file over from a directory to get there - I forget which one). But my prompt looks like this now:

(lpthw) PS C:\Users\paulc.venvs\lpthw\projects\skeleton>

In Zed’s video the “lpthw” directory is not in the prompt. (In the book the entire directory prompt doesn’t seem to be listed anywhere, which is why I think I got confused.) As I said, everything downstream from the \skeleton dir is there (with the small problem mentioned in Q2 below). So … Should I be moving the \skeleton dir and its contents up so that it is a daughter dir of .venvs and a sister dir of \lpthw ? (I was thinking of just using file explorer to do this.) If I do, will there be any unexpected consequences?

Thoughts? If it’s “ok” I’ll do so, but I haven’t edited anything beyond this point yet.

  1. I ALWAYS type the exercises by hand, but this time I was concerned that I might make an undetected error in such a complicated (to me!) process, so I copy-pasted “” from the book, editing out the line numbers of course. The weird thing is that the size of the resulting file was a few bytes larger than Zed’s example in the video. Maybe I’ve got an extra space or two that I can’t see, but I did look diligently and couldn’t find any differences in my text.

Is this likely to make a difference going forward as we work with these testing files?

Thanks to all who read this. I appreciate those of you with a much higher knowledge level than mine taking the time to read through what must be really simple noob questions, and assuming that I’ve done my due diligence before posting. (Clearly one day soon I’ve got a lot of “paying it forward” to do.)

Many thx,

Hey Paul,

You’re not supposed to be doing work in your virtualenv at all. What you’re supposed to is create the virtualenv in a directory that’s totally outside your work. So, in your case, you have this:


That is your virtual environment and you enable that. Now, you create ALL OTHER CODE IN A TOTALLY DIFFERENT LOCATION OR TERRIBLE THINGS HAPPEN. So, this is completely bad:


What you want is this:


See how you are just in your lpthw directory where you’re studying and there’s your code?


After a few days of trying I deleted everything and started over, and now have the desired result. Not sure why all this became so difficult for me. It might have been the partial paths in the text?

BTW, I’ve been working all on my own on this. LPTHW is the only book I’ve been able to follow on a consistent basis. Thanks!

(I’ll probably be back soon with more dumb questions.) :wink:


I’m a big fan of deleting things and starting over. I find for most programmers that the start is the hardest part, and if you get just a few little things wrong in the beginning it usually compounds into more errors later. That means when you get stuck in the beginning it’s easier to just trash it and do it again. The beginning is also where you’ve spent the least amount of investment, so it’s easiest to throw it out. Finally, if the start is the hardest then practicing the start over and over is good practice.

I’ve been stuck on this as well.


  1. Is the “module” a new .py file with functions created inside /bin? Or is it just a function inside the project .py file?
  2. Is “a Python script that’s runnable for your system” something that can be imported into the project using import?

Lengthy: is in /bin. I have been able to install and uninstall the module from the main project directory using pip. However, when I call the module using import name_game in my test file, I get:

ModuleNotFoundError: No module named 'name_game'

The same error comes up when I call from bin import name_game. Nosetests return the same error.

After reading the docs, and including ext_modules, name_game can no longer be installed or uninstalled using pip, but the program passes all nosetests. The setup reads:

    ext_modules=[Extension('pkg.name_game', ['src/name_game.c'])],
        'name_game': [

Oh, that ext_modules is for C programming language modules, so you definitely don’t want to set that at all. That’s voodoo wizard stuff.

If the file is in bin/ but you want to include it as a module then you should do this:

  1. Put name_game into it’s own module: game/ would be good.
  2. Change your bin/ to do this:
from import *
  1. Then have bin/ just call some beginning function to get things rolling, that function is in game/
  2. Once you do that, when you want to import the module you import The file bin/ is simply a pointless shell just for install.
  3. You then need to tell where your game/ module is so that it includes it. I have instructions for that in the book.

I followed your advice, including removing the ext_modules label. It’s working! One question:
Why do we need the pointless shell in bin/? Why can’t it point directly to game/

Well, you need some program people can run from the command line and which can install BUT you also may want to use the module as a module. The compromise is to carve out everything into a module and then just make the stub in bin/ like I suggest.