PDA

View Full Version : [SOLVED] Geany & python easygui



rabbitman
April 10th, 2008, 02:33 AM
I've made a short test routine in python using easygui, which does nothing more than display a messagebox on the screen.

I've also set PYTHONPATH in my .bashrc file so easygui can be found.

If I run the following from a terminal the program I've written works correctly.


python test.py

If I try and run the program in geany however, I get an ImportError message telling me that the easygui module cannot be found.

Can anyone offer any help? :(

dwblas
April 10th, 2008, 03:40 PM
You'll have to use a sys.path.append("/path/to/easygui"). Geanly can't find it. First, did you reboot after adding the path to PYTHONPATH? Second, print sys.path, which will tell you if the path has been added (and check for typos). Third, being a general text editor, it's possible that Geany doesn't use PYTHONPATH for python specific things.

rabbitman
April 10th, 2008, 04:42 PM
Thank's for trying to help. :KS

I'd already tried the sys.path.append thing & it didn't work. :(

The problem appears to be a Linux one, as I own an Ubuntu / Vista Dualboot. I've got Geany & DrPython (http://drpython.sourceforge.net/index.php) installed on both operating systems. EasyGui is on the PYTHONPATH in Vista & everytime I run my test program it works.But when I try running my program in Ubuntu neither Geany or DrPython can locate easygui on the PYTHONPATH.

LaRoza
April 10th, 2008, 04:53 PM
Thank's for trying to help. :KS

I'd already tried the sys.path.append thing & it didn't work. :(

The problem appears to be a Linux one, as I own an Ubuntu / Vista Dualboot. I've got Geany & DrPython (http://drpython.sourceforge.net/index.php) installed on both operating systems. EasyGui is on the PYTHONPATH in Vista & everytime I run my test program it works.But when I try running my program in Ubuntu neither Geany or DrPython can locate easygui on the PYTHONPATH.

Put the easygui.py in the same directory as your script then.

WW
April 10th, 2008, 07:48 PM
First, did you reboot after adding the path to PYTHONPATH?
Reboot? Nah, this is not windows. At worst he could log out and log in. If that doesn't work, rebooting won't help.

WW
April 10th, 2008, 08:08 PM
If you are using gnome (i.e. the standard Ubuntu, not, say Kubuntu, Xubuntu, etc), and you are starting Geany from a gnome menu (and not from the command line), try setting the environment variable in the file .gnomerc. (That used to work, but I'm not sure it still does.) If that doesn't work, try .xsession. (Be sure to save a backup before you go mucking around with these files.) You might have to log out and log in again for the change to take effect.

EDIT: ... or maybe .xprofile, or .xinitrc, or ...? Sorry, I only have access to an Ubuntu server with no X at the moment, so I can't test it, and trying to find a definitive answer by googling has been fruitless.

rabbitman
April 11th, 2008, 02:19 AM
Thank's for everyone who tried to help, the problem is now solved. :)

I found this (http://ubuntuforums.org/showthread.php?t=724070) thread on the forum regarding someone who was having Java classpath trouble in Geany.

Based on what I read there, I added the PYTHONPATH variable to the file located at /etc/profile. I rebooted my computer & the easygui program I wrote worked first time.

dwblas
April 12th, 2008, 08:00 PM
Thanks for posting the solution. It's interesting that Geany is reading a system-wide profile file and seemingly ignoring the user's .bashrc. This will likely come up again, and may be pertinent to other programs as well.

rabbitman
April 13th, 2008, 07:05 AM
Thank's for the comment, so far only Geany (http://geany.uvena.de/) & DrPython (http://drpython.sourceforge.net/) appear to have this problem.

Thread marked as solved. :)