[Tutor] import pygame

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Tutor] import pygame

Tamar Osher
Hello.  I cannot successfully import third party modules.  I have tried various things and searched online.  Pygame is installed on my Windows 7 computer at C:\python32\pygame.  Can someone please help me?
>>>import pygame
Traceback (most recent call last):
  File "<pyshell#24>", line 1, in <module>
    import pygame
ImportError: No module named pygame
 






_______________________________________________
Tutor maillist  -  [hidden email]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Reply | Threaded
Open this post in threaded view
|

Re: [Tutor] import pygame

Dave Angel-3
On 03/12/2012 07:25 PM, Tamar Osher wrote:
> Hello.  I cannot successfully import third party modules.  I have tried various things and searched online.  Pygame is installed on my Windows 7 computer at C:\python32\pygame.  Can someone please help me?>>>import pygameTraceback (most recent call last):
>    File "<pyshell#24>", line 1, in<module>     import pygameImportError: No module named pygame
>
>
There are a number of places to install packages, but that's not one of
them.  Normally, you'd install them one level down, in dst-packages.

Anyway, you can see the search path of Python, interactively.

Start python, import sys, and print out sys.path    that's the search
path that Python uses to find imports.

There are various ways to modify that, but I don't know what pygame uses.



--

DaveA

_______________________________________________
Tutor maillist  -  [hidden email]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Reply | Threaded
Open this post in threaded view
|

Re: [Tutor] import pygame

Dave Angel-3
Three points of order, then a response, all at the proper place, after
the portion of your message I'm quoting.

On 03/13/2012 05:48 PM, Tamar Osher wrote:
>
> Dear Dave: Hi.  Pygame is located in my computer at c:\Python32\Lib\site-packages\pygame.  I am having difficulty importing and using pygame.  Can someone help, please?
>>>> import sys>>>  print (sys.path)['C:\\Python32\\Lib\\idlelib', 'C:\\windows\\system32\\python32.zip', 'C:\\Python32\\DLLs', 'C:\\Python32\\lib', 'C:\\Python32', 'C:\\Python32\\lib\\site-packages']>>>  import pygameTraceback (most recent call last):  File "<pyshell#2>", line 1, in<module>     import pygameImportError: No module named pygame>>>
>

1) please don't top-post.  In this forum, as in most mailing lists, your
response should go after the portion of whatever message you're quoting.

2) please use text mode email.  By posting in an html format, you cause
the lines of the message to run together.  No harm done in this case,
but it's a bad habit to get into.

3) please use reply-all, or use other means to make sure you include
[hidden email] as a recipient.  You sent this message to me only, and
I don't reply to private emails.


As for your error, you're apparently not running this from a cmd prompt,
but from pyshell. So you've introduced other variables into the
equation, and somebody else will have to help.

Put those lines in a text file, and run them as:

c:\  >>  python3  myfile.py

and see what error you get then. At that point, you know what Python
will do.  If your shell gives worse results, then you have to figure out
the shell.

--

DaveA
_______________________________________________
Tutor maillist  -  [hidden email]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor