Melynda Anne Sherrill
Melynda Anne Sherrill

Reputation: 23

Pygame unable to init?

import pygame, sys

pygame.init()

Here's my error:

File "Final_Project.py", line 1, in import pygame, sys File "/New Folder With Items/pygame.py", line 2, in pygame.init() AttributeError: 'module' object has no attribute 'init'

Upvotes: 1

Views: 518

Answers (1)

sloth
sloth

Reputation: 101072

You named your file pygame.py. By doing so, you created a module named pygame.

So you try to call init on your own file, not the real pygame library.

Just don't name your file pygame.py (or like any other module you want to use, like sys.py etc.).

Upvotes: 3

Related Questions