[Sugar-devel] Problems with import

Alan Jhonn Aguiar Schwyn alanjas at hotmail.com
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"....
Regards
Alan 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20111116/728c7786/attachment-0001.html>


More information about the Sugar-devel mailing list