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:
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:
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.
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 “setup.py” 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.)
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:
c:\Users\paulc.venvs\lpthw\
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:
C:\Users\paulc.venvs\lpthw\projects\skeleton
What you want is this:
C:\Users\paulc\lpthw\projects\skeleton
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.)
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.
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:
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/name.py?
Well, you need some program people can run from the command line and which setup.py 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.