Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80900 > unrolled thread
| Started by | ryguy7272 <ryanshuell@gmail.com> |
|---|---|
| First post | 2014-11-16 12:39 -0800 |
| Last post | 2014-11-17 00:35 -0700 |
| Articles | 8 — 7 participants |
Back to article view | Back to comp.lang.python
import graphics library; causes error ryguy7272 <ryanshuell@gmail.com> - 2014-11-16 12:39 -0800
Re: import graphics library; causes error Terry Reedy <tjreedy@udel.edu> - 2014-11-16 18:09 -0500
Re: import graphics library; causes error ryguy7272 <ryanshuell@gmail.com> - 2014-11-16 19:03 -0800
Re: import graphics library; causes error Chris Angelico <rosuav@gmail.com> - 2014-11-17 14:11 +1100
Re: import graphics library; causes error Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-17 21:24 +1100
Re: import graphics library; causes error Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-17 12:14 +0000
Re: import graphics library; causes error YBM <ybmess@nooos.fr.invalid> - 2014-11-17 13:21 +0100
Re: import graphics library; causes error Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-17 00:35 -0700
| From | ryguy7272 <ryanshuell@gmail.com> |
|---|---|
| Date | 2014-11-16 12:39 -0800 |
| Subject | import graphics library; causes error |
| Message-ID | <acf29cb8-d11b-4134-8d03-7be5a078eae6@googlegroups.com> |
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
[toc] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2014-11-16 18:09 -0500 |
| Message-ID | <mailman.15921.1416179426.18130.python-list@python.org> |
| In reply to | #80900 |
On 11/16/2014 3:39 PM, 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'. In what directory? > 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(): [snip 20 lines of 2.x code (it used raw_input)] > 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 After opening Idle, I would first try >>> import graphics in the shell before entering any code. When that failed, I would look in lib/site-packages to see the actual module or package name installed, and maybe look in the doc for the package about how to import it. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | ryguy7272 <ryanshuell@gmail.com> |
|---|---|
| Date | 2014-11-16 19:03 -0800 |
| Message-ID | <0925b45d-aa27-472c-af81-f1594ee17ead@googlegroups.com> |
| In reply to | #80900 |
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!
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-11-17 14:11 +1100 |
| Message-ID | <mailman.15944.1416193923.18130.python-list@python.org> |
| In reply to | #80956 |
On Mon, Nov 17, 2014 at 2:03 PM, ryguy7272 <ryanshuell@gmail.com> wrote: > 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? Most definitely not. That is not how you should go about installing things. You're packing everything into the standard library, certain to cause a mess. Just leave them in site-packages - they ought to be importable from there. If they're not, you most likely have one very simple configuration issue to fix, and then everything will just work. > 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. > You're blaming Python for your poor use of it. Python, as a technology, is not the cause of your issues. Get to know the language and its standard library first, then move on to learning about the entire ecosystem of PyPI packages; base your opinion of Python primarily on the language, not on what people do with it. Do you judge C on the basis of the IOCCC? No, you judge it on the basis of manual memory management and segfaults. (That said, I do like C... as a language for writing high level languages in. I try to avoid writing actual C code.) ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2014-11-17 21:24 +1100 |
| Message-ID | <5469ccd4$0$13005$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #80956 |
ryguy7272 wrote: > 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. Thank you for setting us right. Would you mind dropping a note to Google, DropBox, NASA, CERN, Microsoft, Industrial Light & Magic, Rackspace, Honeywell and Red Hat, and tell them that based on your extensive experience (all ten minutes of it) they're obviously doing it wrong and Python is a toy language not suitable for critical business apps? I'm sure that they will be grateful to be set right. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-11-17 12:14 +0000 |
| Message-ID | <mailman.15957.1416226510.18130.python-list@python.org> |
| In reply to | #80956 |
On 17/11/2014 03:03, ryguy7272 wrote:
> 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!
>
A bad workman always blames his tools.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | YBM <ybmess@nooos.fr.invalid> |
|---|---|
| Date | 2014-11-17 13:21 +0100 |
| Message-ID | <5469e832$0$12771$426a74cc@news.free.fr> |
| In reply to | #80956 |
Le 17/11/2014 04:03, ryguy7272 a écrit : > 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 * >> [...] > 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' Except when the module does not exist in pypi... In such case either easy_install and pip finish by printing out that the module cannot be found... graphics.py is NOT distributed through pypi, you have to download and copy it by yourself in an appropriate place from the author's Web site: http://mcsp.wartburg.edu/zelle/python/graphics.py > 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. MS Windows 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 Linux boxes. I would never use MS Windows as a foundation for a mission critical business application. Hopefully I'm not the only one to think so...
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-11-17 00:35 -0700 |
| Message-ID | <mailman.15949.1416209789.18130.python-list@python.org> |
| In reply to | #80900 |
On Sun, Nov 16, 2014 at 1:39 PM, ryguy7272 <ryanshuell@gmail.com> wrote: > 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. A couple of notes. One is that the state of the art in Python package management is pip, not easy_install. It's still a command-line tool, but I recommend sticking to that if possible. Your command 'easy_install python graphics' attempts to install two separate packages named 'python' and 'graphics'. The first package seems to refer to the Python interpreter itself -- neat, I didn't realize that Python itself was listed in PyPI. But probably not what you were looking for, since running easy_install would tend to imply that Python is already installed. The second page does not seem to exist; there is no package named 'graphics' in PyPI. So I don't know what it is that you believe you installed.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web