1

The code,

print 'hello world'
raw_input()

"works" when ran in python idle 2.7 as well as in lxterminal ("python helloworld.py").

I then made an application thru Gambas3 using it as an interpreter for python programming. When simulating, everything works and the lxterminal shows the output and exits when the enter key was pressed. After compiling, making the software as an executable. Ran the application and ran the code it throws the EOF error. I searched the web, found lots of similar problems but different approach. I read something about pipe line something which I couldn't understand. I also added the python usage options -i -tt and -c but no luck. Any idea whats causing this error?

This was also my code for run button in Gambas3 incase someone ask.

Public Sub RunBtn_Click()

  TextArea3.Text = ""
  Try Kill Application.Path & "tempfile.py"
  If Exist(Application.Path & "tempfile.py") Then
    hFile = Open Application.Path &/ "tempfile.py" For Write Append
    Else 
    hFile = Open Application.Path &/ "tempfile.py" For Write Create 
    Endif
  Print #hFile, TextArea2.text
  Wait 0.3

  MyProc = Shell "lxterminal --command python -i -tt -c " & Application.Path &/ "tempfile.py" For Read As "Process" 
  MyProc1 = Shell "python -i -tt -c " & Application.Path &/ "tempfile.py" For Read As "Process"

End
  • What is the purpose of the `raw_Input()`? – xrisk Feb 05 '16 at 15:28
  • I used it for pause, wait for enter key before the lxterminal exits. without raw_input(), the lxterminal immediately closes without showing the output. – Vien Merciful Feb 05 '16 at 16:01
  • is there no pause command or equivalent functionality within Gambas? – xrisk Feb 05 '16 at 16:07
  • the code is in python, not in gambas. gambas3 just interprets the program written in python. – Vien Merciful Feb 05 '16 at 16:25
  • You don't provide any input to the process, so it's input is depleted, which `raw_input()` signals accordingly. This has nothing to do with Python, it's rather the way you start your program. BTW: Gambas surely doesn't interpret the code, it starts a new process running a shell which then interprets the code given to it. That shell then starts another process with the Python interpreter. – Ulrich Eckhardt Feb 05 '16 at 17:57
  • Thanks for pointing that out. However, It's still not clear to me why the whole program works when simulated within Gambas but doesn't work once it is compiled and became an executable. – Vien Merciful Feb 06 '16 at 03:51
  • In addition, when I run LXTerminal in the taskbar, left it open. then open the gambas executable, then ran the python code. It doesn't threw any error and the python code works. – Vien Merciful Feb 06 '16 at 09:23

0 Answers0