Jump to content

  • Log In with Google      Sign In   
  • Create Account


Importing Modules in Python


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 LeafieTail   Members   -  Reputation: 99

Like
0Likes
Like

Posted 12 March 2011 - 01:34 AM

I am having trouble importing modules in python. Can someone help me so I can do object oriented programmed games.

Sponsor:

#2 SriLumpa   Members   -  Reputation: 198

Like
0Likes
Like

Posted 12 March 2011 - 02:27 AM

Many people can probably help you, but you have to be more specific: show the error, the problematic import code, and whether the module is installed on your system.

#3 The Communist Duck   Members   -  Reputation: 154

Like
0Likes
Like

Posted 13 March 2011 - 08:59 AM

import antigravity

Did you know that actually works?

You must have some weird error, since to import module foo, you do:
import foo



#4 ChaosEngine   Crossbones+   -  Reputation: 2140

Like
0Likes
Like

Posted 14 March 2011 - 09:05 PM

The most likely reason is that your module is not in the search path.

From the python module docs
When a module named spam is imported, the interpreter searches for a file named spam.py in the current directory, and then in the list of directories specified by the environment variable PYTHONPATH. This has the same syntax as the shell variable PATH, that is, a list of directory names.


if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS