Closed sher85 closed 7 years ago
How are you starting Geany?
I'm using Rasbian.
I open the start menu, select Programming, then select Geany from the list
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.
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.
Ok, so what is your Edit->preferences->tools->terminal
setting?
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
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.
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)
@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.
@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.
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.
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 :)
@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!
Thank you @elextr and @b4n. You saved me from a week-long headache :)
@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.
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.
@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.
@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
@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)
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.