import graphics library; causes error

ryguy7272 ryanshuell at gmail.com
Mon Nov 17 04:03:26 CET 2014


On Sunday, November 16, 2014 3:39:45 PM UTC-5, ryguy7272 wrote:
> These libraries drive me totally nuts.  Sorry, just had to get it out there.
> Anyway, I open the cmd window, and typed this: 'easy_install python graphics'.  So, it starts up and runs/downloads the appropriate library from the web.  I get confirmation (in the cmd window) that it finishes, then I try to run this script.
> 
> 
> # futval_graph2.py
> from graphics import *
> def main():
>   # Introduction
>   print "This program plots the growth of a 10-year investment."
>   # Get principal and interest rate
>   principal = input("Enter the initial principal: ")
>   apr = input("Enter the annualized interest rate: ")
>   # Create a graphics window with labels on left edge
>   win = GraphWin("Investment Growth Chart", 640, 480)
>   win.setBackground("white")
>   win.setCoords(-1.75,-200, 11.5, 10400)
>   Text(Point(-1, 0), '0.0K').draw(win)
>   Text(Point(-1, 2500), '2.5K').draw(win)
>   Text(Point(-1, 5000), '5.0K').draw(win)
>   Text(Point(-1, 7500), '7.5k').draw(win)
>   Text(Point(-1, 10000), '10.0K').draw(win)
>   # Draw bar for initial principal
>   bar = Rectangle(Point(0, 0), Point(1, principal))
>   bar.setFill("green")
>   bar.setWidth(2)
>   bar.draw(win)
>   # Draw a bar for each subsequent year
>   for year in range(1, 11):
>     principal = principal * (1 + apr)
>     bar = Rectangle(Point(year, 0), Point(year+1, principal))
>     bar.setFill("green")
>     bar.setWidth(2)
>     bar.draw(win)
>   raw_input("Press <Enter> to quit.")
> 
> 
> After I hit F5, I get this:
> Traceback (most recent call last):
>   File "C:\Users\Ryan\Desktop\Graphics_Test.py", line 2, in <module>
>     from graphics import *
> ImportError: No module named graphics



In what directory?
Well, that's a damn good question.  I thought, by defailt, everything was downloaded to this folder:
'C:\Python27\Lib\site-packages'

In there, I have all kinds of things like:
'setuptools-6.1.dist-info', 'pip-1.5.6.dist-info', etc.
All kinds of other things too.  

It seems there is always a copy, so I cut/paste the folders named 'setuptools' & 'pip' (always taking off the versions and identifiers and the like...).  Then I cut/paste everything into this folder:
'C:\Python27\Lib'

Is that how it's done or not?  Honestly, for the life of me, I don't know why a human being would have do do any of this, including using the cmd window, to install anything in 2014.  I can code in 10 different languages, not including Python.  Python is by far the most backwards type of technology that I can think of.  Using it is completely counter-productive.  I can't take it serious.  I have plenty of tools in my toolbox.  I'll keep learning Python, and keep reading books, and keep using it...but strictly for fun.  I would never use this as a foundation for a mission critical business application.

Thanks everyone!



More information about the Python-list mailing list