[Sugar-devel] Problems with import

Walter Bender walter.bender at gmail.com
Wed Nov 16 07:07:33 EST 2011


On Wed, Nov 16, 2011 at 6:31 AM, Alan Jhonn Aguiar Schwyn
<alanjas at hotmail.com> wrote:
>
> For a while I'm trying to do something as simple as a try, except for
> imports in Python
> I 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 camera
Don't you mean:
        from pygame import camera
> except:
Probably want:
    except ImportError:
>      del pygame
> sys.path.insert (0, 'lib')
> import pygame
> import pygame from camera
and
        from pygame import camera
>
> This code does not work, what am I doing wrong?
Not sure how either camera import works given how you have it coded.

-walter

> 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 pygame
> import pygame from camera
> The code import "pygame" from the folder "lib"....
> Regards
> Alan
> _______________________________________________
> Devel mailing list
> Devel at lists.laptop.org
> http://lists.laptop.org/listinfo/devel
>
>



-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org


More information about the Sugar-devel mailing list