Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6980661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:03:19+00:00 2026-05-27T18:03:19+00:00

In a nutshell On Ubuntu 11.10, for the pygame library, pydev reports undefined variables

  • 0

In a nutshell

On Ubuntu 11.10, for the pygame library, pydev reports “undefined variables from imports”. On Windows 7, everything is fine. On both platforms, the code works properly.

This is the same error as this thread (and a bunch of others). Removing and re-adding my interpreter did not change anything. I also tried to include pygame as a forced built-in lib, but it did not change anything (I checked that pygame was in system PYTHONPATH).

Configs

On both Ubuntu and Windows, I’m using Eclipse Indigo and Python 3.2.

On Ubuntu, I’m using:

  • Ubuntu 11.10
  • Pygame 1.9.2pre compiled from the pygame Hg repo. When built and installed, the site-packages/pygame folder contains a bunch of .so and .py files.

On Windows7:

  • Windows 7 pro with SP1
  • Pygame 1.9.2pre from lfd.uci.edu. The MSI created a bunch of .pyd and .py to the site-packages/pygame folder.

I understand that static analysis can’t go inside .so files on Ubuntu. I also understand that Python is a dynamic language. Hence pydev has limitations inherent to static analysis. But pydev on Windows 7 manages to link the classes inside .pyd files, which are dynamic libs. Why? And how could I make it work on Ubuntu?

Hints?

import pygame
from pygame.locals import *

With the above code in Ubuntu, I can ctrl-click (or f3) to the pygame package, but not to the pygame.locals. On Windows I can go to both.

import pygame
import pygame.locals
from pygame.locals import *

Now I can go to pygame.locals. I guess that helped pydev to figure out what to “expect”, since locals.py actually exists in the site-packages/pygame folder. But I don’t want to change all my code just to suit pydev.

Anyway, the line below still raises “undefined variable from import” on Ubuntu, but not on Windows.

except pygame.error:

PS: In case that helps, I have a 64 bit Lenovo T410, and installed everything for 64 bits.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:03:20+00:00Added an answer on May 27, 2026 at 6:03 pm

    I’ve just tested it here on Ubuntu and it seems to work properly for me… can you post the following to try to help you fix it there:

    1. Remove the ‘pygame’ from your forced builtins if you added it (it shouldn’t be needed for this specific use-case… by looking at its structure it seems the static analyzer should be able to deal with it properly, and the .so files in pygame will automatically be handled by a shell, so, it’s not necessary to explicitly deal with it).

    2.Having a program with:

    import sys
    print '\n'.join(sorted(sys.path))
    import pygame.locals
    print pygame
    print pygame.locals
    

    What’s the output it gives you when you launch it from PyDev? (I’m interested in knowing the full path to pygame, whether it’ll throw an ImportError in runtime and your full PYTHONPATH)

    3. Do you have some error in your error log? (PyDev is able to introspect .so files, but it’ll launch a separate python shell and communicate with it through sockets, so, it’s possible that something is blocking things there).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a nutshell, I have a solution that builds fine in the IDE, and
In a nutshell, the app looks up an instruction for something to do from
Ok here's my problem in a nutshell I've built a web service from ruby
Nutshell: I launch a thread from my form, then some time later use the
Im using the PredicateBuilder as seen here http://www.albahari.com/nutshell/predicatebuilder.aspx , everything works great, and now
I have this code copied from C# 4.0 in a nutshell that uses Attribute/Reflection
the problem in a nutshell: running plink(with specific arguments) works from cmd, but not
In a nutshell we're unable to get reasonable scrolling performance from any kind of
Browsing the code sample from C# 4.0 in a nutshell I came across some
In a nutshell, I want to write my own device driver for windows, so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.