Problems with import

Alan Jhonn Aguiar Schwyn alanjas at
Wed Nov 16 06:31:51 EST 2011

For a while I'm trying to do something as simple as a try, except for imports in PythonI can not! Help!
I have some code that uses the module "Camera" Pygame.This module is only in the new version of Pygame (1.9.1)
My idea is:
If Pygame 1.9.1 is installed, use it ..Otherwise, use a Pygame that I have a folder "lib" and compiled ...
My code looks something like this:
import sys
try:     import pygame     import pygame from cameraexcept:     del pygame
sys.path.insert (0, 'lib')
import pygameimport pygame from camera

This code does not work, what am I doing wrong?
The second "import pygame" should import first found in "lib"but continues to import that are in the system .. Why ??????????????
If you just do:
sys.path.insert (0, 'lib')
import pygameimport pygame from camera
The code import "pygame" from the folder "lib"....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Devel mailing list