1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Importing problems

Posted by eff on Mar 25, 2010

I'm trying to use pyfacebook with NodeBox. I put facebook.py (renamed from __init__.py) in /usr/lib/Python2.5/ (and 2.6), which works fine with python but not in NodeBox. At first I kept getting errors from ximport, and now I can't even get this line to compile:

facebook = ximport("facebook")
Sticking this in any file just makes the file stop working, not generating any errors or any kind of information...


 
Posted by Josh Caswell on Mar 30, 2010

Why did you rename the file instead of using the python convention of a directory with the name of the library, and an __init__.py file inside?

What is the nature of "just stop working"? The script seems to run (you see the spinning beachball) but does not draw anything to the canvas? Have you tried putting a print statement or two into the body of the script to make sure it executes?

Python likes to generate errors when something goes wrong. . .it does not silently fail to execute. It sounds like python or NB are doing what they think you want, but you are not telling them the right thing.

Posting the rest of the script, or as much as you can, would also help us to diagnose the problem.



Posted by Josh Caswell on Mar 30, 2010

Also, NB is sometimes funny about finding libraries in the standard python locations. Have you tried putting pyfacebook into ~/Library/Application Support/NodeBox?