Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geany not picking up Python on Raspberry Pi 3 #1624

Closed
sher85 opened this issue Oct 4, 2017 · 19 comments
Closed

Geany not picking up Python on Raspberry Pi 3 #1624

sher85 opened this issue Oct 4, 2017 · 19 comments
Labels

Comments

@sher85
Copy link

sher85 commented Oct 4, 2017

Writing my first Hello World code which runs perfectly on Terminal, however, on geany upon pressing the execute button a terminal screen pops up with the title geany_run_script_XXXXXX.sh (XXXXXX is a variation of numbers and letters, each time different. Currently T7NX7Y) and remains blank with no code running.

My Build Commands are set to:
Compile -----> /usr/bin/python3 -m py_compile "%f"
Execute -----> /usr/bin/python3 "%f"

What is preventing geany from running my code? It works just fine when ran from Terminal.

@elextr
Copy link
Member

elextr commented Oct 4, 2017

How are you starting Geany?

@sher85
Copy link
Author

sher85 commented Oct 4, 2017

I'm using Rasbian.

I open the start menu, select Programming, then select Geany from the list

@elextr
Copy link
Member

elextr commented Oct 5, 2017

Ok, starting from the menu likely does not set your environment variables correctly because it runs Geany without a shell so ~/.bashrc and ~/.profile and so on are not run. Therefore Python3 is run with the wrong environment. To confirm that as the problem, start geany from the terminal where running your python program works and then try it.

@sher85
Copy link
Author

sher85 commented Oct 5, 2017

I opened Terminal and typed in geany, then the Geany program opened up with the two python files I had written before. When I tried running them, I got the same error.

For convenience, I took a screenshot and I'm going to upload it here. It shows the original terminal (ignore the $$ symbols, I typed them on accident), the "geany_run_script_XXXXXX.sh" terminal window that pops up when I execute the code, and the Set Build Commands for reference.

screen shot 2017-10-04 at 7 53 24 pm

@elextr
Copy link
Member

elextr commented Oct 5, 2017

Ok, so what is your Edit->preferences->tools->terminal setting?

@b4n
Copy link
Member

b4n commented Oct 5, 2017

could you give use the debugging messages that can be found in Help → Debug messages after trying to run the script also?
Also, is your Python effectively in /usr/bin? try which python3 in your terminal.

But @elextr is likely to have the right question and your terminal/terminal command isn't properly set up

@elextr
Copy link
Member

elextr commented Oct 5, 2017

But @elextr is likely to have the right question and your terminal/terminal command isn't properly set up

Or its set to one of the terminal programs that won't run commands properly.

@sher85
Copy link
Author

sher85 commented Oct 5, 2017

elextr,
My terminal setting is: x-terminal-emulator -e "bin/sh %c"

b4n,
These are the debuging messages:

20:06:03: Geany INFO		: Geany 1.29, en_US.UTF-8
20:06:03: Geany INFO		: GTK 2.24.31, GLib 2.50.3
20:06:03: Geany INFO		: System data dir: /usr/share/geany
20:06:03: Geany INFO		: User config dir: /home/pi/.config/geany
20:06:03: Geany INFO		: System plugin path: /usr/lib/arm-linux-gnueabihf/geany
20:06:04: Geany INFO		: Added filetype Graphviz (61).
20:06:04: Geany INFO		: Added filetype Genie (62).
20:06:04: Geany INFO		: Added filetype Scala (63).
20:06:04: Geany INFO		: Added filetype Clojure (64).
20:06:04: Geany INFO		: Added filetype JSON (65).
20:06:04: Geany INFO		: Added filetype Cython (66).
20:06:04: Geany INFO		: Added filetype CUDA (67).
20:06:04: Geany INFO		: Loaded libvte from libvte.so.9
20:06:04: Geany INFO		: /home/pi/hola.py : Python (UTF-8)
20:06:04: Geany INFO		: Loaded /usr/share/geany/tags/std.py.tags (Python), 5964 symbol(s).
20:06:04: Geany INFO		: /home/pi/FirstProgram.py : Python (UTF-8)

@b4n
Copy link
Member

b4n commented Oct 5, 2017

@sher85 and which terminal application actually opens? Is it Konsole, or something similar? try setting it to xterm instead of x-terminal-emulator and see if it fixes it (possibly installing xterm though)

OK it's probably rather lxterminal, but it might have the same issue -- namely that it's not following the xterm command-line syntax.

@elextr
Copy link
Member

elextr commented Oct 5, 2017

@sher85 x-terminal-emulator is a virtual command that actually runs some other command, like gnome-terminal or something. You need to find which it actually runs and then if the -e option is correct for that terminal.

Probably best to configure Geany to use a specific terminal so you know what its running.

@sher85
Copy link
Author

sher85 commented Oct 5, 2017

switching it from x-terminal-emulator to xterm did not work, instead of a terminal pop-up window I got:
20:17:42: Cannot execute build command "xterm -e "/bin/sh /tmp/geany_run_script_QGLX7Y.sh"": No such file or directory. Check the Terminal setting in Preferences

The terminal I use is the one that came with the Pi, when I hover over it its labeled "Terminal". Its the 4th icon on the top left corner of my screenshot from before.

@elextr
Copy link
Member

elextr commented Oct 5, 2017

As @b4n noted, do you have xterm installed?

Note that nobody here has Raspian, you have to tell us everything, so "hover over 4th icon" is not very helpful :)

@sher85
Copy link
Author

sher85 commented Oct 5, 2017

@elextr Sorry, my geocentrism makes me think everybody is using Rasbian right now, loool! Guess I'm human. :P

I went ahead and installed xterm and switched my terminal setting to xterm instead of x-terminal-emulator as @b4n noted....and it worked!

screen shot 2017-10-04 at 8 31 52 pm

@sher85
Copy link
Author

sher85 commented Oct 5, 2017

Thank you @elextr and @b4n. You saved me from a week-long headache :)

@elextr elextr added the resolved label Oct 5, 2017
@elextr elextr closed this as completed Oct 5, 2017
@codebrainz
Copy link
Member

@sher85 can you go into the other terminal and look in Help->About and report back here what it is? This will help us figure out the problem and know which terminals are busted.

@b4n
Copy link
Member

b4n commented Oct 5, 2017

FWIW apparently lxterminal works fine with the default command we have on my Debian Jessie -- that is, if I use lxterminal -e "/bin/sh %c" as the terminal command.

@sher85
Copy link
Author

sher85 commented Oct 5, 2017

@codebrainz The terminal I was using at the beginning of this thread was LXTerminal and since I have switched to Xterm which, along changing the terminal command, resolved the issue for me.

@b4n unfortunately changing it to lxterminal -e "/bin/sh %c didnt work on my side, xterm -e "/bin/sh %c" did after installing xterm.

@codebrainz
Copy link
Member

@sher85 ok good to know. did you make a typo there missing the trailing quote on the lxterminal command?

FWIW, lxterminal works fine here too with python or python3, Ubuntu 16.04

@sher85
Copy link
Author

sher85 commented Oct 5, 2017

@codebrainz
That was a typo in my comment, sorry, but I did use the trailing quote when I typed it in my the Terminal, actually copied it straight from @b4n 's response. I'm attaching a screenshot of it.

I tried it on a second RPI that I have and had the same results with both codes: LXTerminal (no go) and with Xterm (worked! after installing xterm on it)

screen shot 2017-10-04 at 10 08 10 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants