error: video system not initialized; Is there a solution?

I have looked and looked. Every I find this question asked, the person is told to call pygame.init() When the asker says that they have done that, there are no more replies. I've tried everything I can think of and nothing works.

Traceback (most recent call last): File "C:\Python26\TwC\main.py", line 183, in for e in pygame.event.get(): error: video system not initialized

My imports in case there's a conflict:

#imports import os, sys import pygame from pygame.locals import *

Here's where I'm calling pygame.init(), just to show that I am:

#initialize os.environ["SDL_VIDEO_CENTERED"] = "1" pygame.init() #setup display pygame.display.set_caption("TwC V%s" % version) screen = pygame.display.set_mode((320, 240))

And lastly, here's the area of the line that raises the error:

while running: clock.tick(60) for e in pygame.event.get(): if e.type == pygame.QUIT: running = False if e.type == pygame.KEYDOWN and e.key == pygame.K_ESCAPE: running = False

EDIT: Removing the section of code causing the error just causes the same error to be caused by another section, so that means issue is with pygame.init() I'm thinking of just scrapping the whole thing and redoing it. It didn't take long to do.


Can you run this boilerplate successfully ? Pygame, simple physics engine, how to hold points between planes?


The very simple fix is to insure that the very last line of code in your program pygame.quit() is not indented. Errors will make it seem to be earlier lines in your code....fooled me a for about 15 minutes.


  • Why isn't the ball bouncing back?
  • While loop waiting for input python
  • Python Tkinter Threading - How to end / kill / stop thread when user closes GUI
  • Hangman Game Python Error
  • Can't import Datastore from google.cloud
  • Treating a string as an integer
  • How to use google-closure-compiler-js for a node.js app without gulp/grunt/webpack?
  • html select tag in webview seems to be problematic
  • Android Launcher application compilation on Eclipse
  • How to insert images into SQL Server database table
  • Can't Resolve fromJson
  • Avoiding duplicated data in PostgreSQL database in Python
  • instance of class held by composition container in mef
  • Passing Parameters to An Overrode View in Django/Allauth
  • Prevent OS X from going to sleep with Python?
  • Rebol - HTTP response headers
  • How to fix error Cannot find name 'object' in angular 2 cli ckeditor
  • How to use Webpack loaders syntax ( imports/exports/expose) with ECMAScript 6 imports?
  • Get the results of dis.dis() in a string
  • TableViewer shrinks to a single row with a scroll bar when new input is set
  • How do I create a M2Crypto DSA object given parameters and key values?
  • Destructuring assignment within import statements
  • BBC micro:bit - Radio string transfer random carriage returns
  • How to Autowire repository interface from a different package using Spring Boot?
  • The android java class cannot recognize the R file
  • When getting Document object from Word.Application object, its members are not filled from gencache
  • how to avoid the dependencies hell with unit test in angular 2+
  • Perl function name clash
  • JSF NumberFormatException with f:setPropertyActionListener
  • Obtain ObjectIdHex value from mgo query
  • Why winpcap requires both .lib and .dll to run?
  • Apache 2.4 - remove | delete | uninstall
  • Return words with double consecutive letters
  • Cannot Parse HTML Data Using Android / JSOUP
  • Python: how to group similar lists together in a list of lists?
  • Proper folder structure for lots of source files
  • How do you join a server to an Active Directory (domain)?
  • Understanding cpu registers
  • How does Linux kernel interrupt the application?
  • Busy indicator not showing up in wpf window [duplicate]