Jump to content


Photo

Chapter 2 - No Build Folder In Nester


  • Please log in to reply
2 replies to this topic

#1 David2.0

David2.0

    New Member

  • Members
  • Pip
  • 2 posts

Posted 19 March 2014 - 05:29 AM

snip1.JPG

next I notice that this did not match what was on page 42. There is no build folder.

snip2.JPG

>>> import nester
>>> cast = ['Palin', 'Cleese', 'Idle', 'Jones', 'Gilliam', 'Chapman']
>>> nester.print_lol(cast)
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
nester.print_lol(cast)
AttributeError: 'module' object has no attribute 'print_lol'
>>>

This is what I did in the shell.

def print_lol(movies):
for each in movies:
if isinstance(each,list):
print_lol(each)
else:
print(each)

This is my code.

What am I doing wrong? Is there something else I need to do. I tried this on several windows 7 computers and had the same results.
I was running 3.3 and thought it had something to do with that build. But I get the same results with 3.4

Edited by David2.0, 19 March 2014 - 05:31 AM.


#2 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 19 March 2014 - 11:16 AM

Sorry you are having trouble.

Please read this forum entry: http://forums.oreill...864#entry113864

I've just rechecked this again on Windows 7 using Python 3.4, and it worked fine. My code matches what's in the book, and is downloadable from the book's pages at the http://headfirstlabs.com site. Although things have changed a little since 2010 (when the book was written) the process still works.

I put the code in c:\nester, then built and installed the module, as per the instructions in the above-mentioned forum entry.

Here's a screenshot which shows you what to expect when the build/install commands are issued on Windows 7: http://python.itcarlow.ie/images/1.png

Here's a screenshot which shows the state of my nester folder after the build: http://python.itcarlow.ie/images/2.png

And here's a screenshot of the nester module being importing into Python 3 and used: http://python.itcarlow.ie/images/3.png

I hope these images and the above-mentioned forum entry help.

--Paul.

#3 apasche

apasche

    New Member

  • Members
  • Pip
  • 1 posts

Posted 28 March 2014 - 08:51 AM

Hey David2.0,


I had the same problem, so I created the setup.py file again.
In my case, I misspelled "py_modules". I had used uppercase instead of lowercase
;)

Edited by apasche, 28 March 2014 - 08:53 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users