user2074050
user2074050

Reputation: 179

Python: Import Error

Hey Guys I know this has been asked before, and even various times, but I can't really figure out the exact problem with regards to my issue, even after looking at the other import errors. It's a really basic question, so sorry for that...

I'm writing a program, we'll call it "X.py". I need to import from another file, named graphics.py so my first line of code says:

from graphics.py import *

I'm pretty sure the rest of my code is right, but when I run the program it gives me the error saying

Traceback (most recent call last):
  File "/Users/me/Desktop/X.py", line 1, in <module>
    from graphics import *
ImportError: No module named 'graphics'

Now I clearly have this file downloaded and I put them in a folder called Project X, together.

Any idea how I can get this program to see the other file I guess? Thanks in advance!

Upvotes: 0

Views: 1012

Answers (2)

bob marti
bob marti

Reputation: 1569

You have to download this file and put it in the same folder with your script. From the docstring:

INSTALLATION: Put this file somewhere where Python can see it.

Upvotes: 0

Captain Skyhawk
Captain Skyhawk

Reputation: 3500

Drop the .py

Instead, use:

  from graphics import *

Upvotes: 2

Related Questions