Jump to content
Chapter 2 Code
4 replies to this topic
Posted 15 March 2014 - 08:25 PM
I've been all over the forums on here and have seem many issues with the chapter 2 code. I have tried all of the different urls and none of them work for me. I'm not able to go past page 40 because I can't import the raw html data. Any suggestions?
ImportError: No module named request
Posted 15 March 2014 - 09:26 PM
The error you're getting implies not that the URL is incorrect, but that whatever IDE you're using to write your Python code isn't recognizing the request method. I've just copied and pasted the code you pasted above into two different IDEs. In one, I was able to reproduce the error you posted above. In the other, the import function works. The error code you're seeing implies the IDE you're using can't find or doesn't recognize the request method.
You should try a version of IDLE to test your code. I'm using IDLE 3.3.3 without a problem using the URL you posted above. Let me know if you have any questions about what I've written.
Posted 15 March 2014 - 11:54 PM
Stroodle88 is correct - this code works fine (after changing "decoder" to "decode") when executed in IDLE, as shown in the book.
Posted 16 March 2014 - 09:12 AM
Thanks for the help. Now that I just wiped my cpu for a clean dev environment with only IDLE installed, the code works fine. Now to find an additional product key code for windows 8 on the cheap for a segregated partition for all my "messy" installs and explorations. Any suggestions as to how to handle this? It seems like a fairly sensible thing to keep a sterile dev. environment.
Posted 17 March 2014 - 12:31 PM
I don't know anything about Windows 8 keys, and such. But, if you want to keep your development stuff away from your regular stuff, I'd suggest installing VirtualBox from Oracle on your computer (free download, and free to use). With it, you can create virtual PC's onto which you can install most anything. Once you have VirtualBox up-and-running, I'd suggest installing the latest version of Ubuntu Linux (free download, and free to use). Total cost to you: nothing (other than your time and the downloads, of course). You can then experiment with Python on Ubuntu to your heart's content - and, of course, Python 3 and IDLE3 come pre-installed. :-)
Hope this suggestion helps.... and glad to see your problem is solved.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users