Page 1 of 2

Error when .py file run in CudaText

Posted: 22.07.2022 12:34
by anilanthikad
Hello,
My name is Anil, about 50 years old from India, I am not a programmer yet. I failed 8 times trying to learn Python lol. But still not giving up.
I was a Graphic designer/Creative Director with 26 yrs of exp. But Covid lockdowns destroyed my life, so i started to learn coding.

I stopped using MS Windows and any corporate softwares.
Currently using Pop! OS as my operating system.

Previously i have tried using VSCodium and PyCharm, they are very heavy software. So i was searching for lightweight alternative. And found CudaText and Kate(not using Kate now).
I should admit its not as intuitive to learn how to work in CudaText. But again I am not giving up.

So coming to the support request...

I've attached two screenshot of a very simple python file, same file run in CudaText and in VSCodium.
In VSCodium its runs fine, but not in CudaText; it gives Error massage.

Could anyone please let me know what I am doing wrong in CudaText?
I would love to continue learning CudaText.

Looking for a reply at the earliest,
Thank you in Advance,

Posted: 22.07.2022 13:15
by main Alexey
I see you are using ExternalTools plugin which is not fully OK here - you use 'input()' function which will be not good for ExtTools plugin.
so, use plugin ExTerminal instead.
here are my steps to work with your example.

- create file ~/tt.py with code:

Code: Select all

x=int(input('enter x: '))
w=int(input('enter w: '))
print(x*w)
- (restart CudaText after installing ExTerminal)
- call ExTerminal by clicking its bottom-bar-icon
- in ExTerminal, enter "ls" (dir listing) - file tt.py is here. if it's not here, enter "cd FolderName" in ExTerminal.
- in ExTerminal, enter "python3 tt.py" (python3 is usual Linux command) --> it worked OK here and I see 2 input-messages.

It helps?
I use Xubuntu 20.4.

Posted: 22.07.2022 14:16
by main Alexey

Posted: 23.07.2022 00:26
by anilanthikad
Dear Alexey,
Your awesome!
Thank you for such a quick reply.

Your instructions worked perfectly well.

Also in this case please let me seek one more suggestion from you...

I had created a hotkey to run the current open python document. But it'll open only in "Capture output: Output panel".
I've attached a screenshot for your reference.

Is there anyway i can set it to ExTerminal? Currently the Capture output: dropdown menu dont give this option.

Posted: 23.07.2022 05:36
by main Alexey
No, there is no such option.
There is alternative, Runner:
https://wiki.lazarus.freepascal.org/Cud ... ins#Runner
It also don't have such option.

Posted: 23.07.2022 11:13
by anilanthikad
Alright, Thank you again! =)
Hopefully someday, someone could fix that as it would help a lot =)

Cheers!

Posted: 23.07.2022 11:15
by main Alexey
ExtTools / ExTerminal are independent plugins. why to put output from 1st to the 2nd? ExtTools puts output to the "Output" panel or to the 'Console' panel. it must be OK. :)

Posted: 23.07.2022 11:34
by main Alexey
Another reason: ExTerminal supports N panels at once (you can right-click its sidebar button - then 'New terminal'). so ExtTools cannot know to which panel it can put the text.

Posted: 24.07.2022 00:59
by anilanthikad
Ah ok =),
I am understanding a little better why this function is not feasible.

Like i had mentioned in the first post of mine... I am not a techie, I am still struggling to learn python lol.

but just curious... (maybe what i am trying to suggest is really silly, apologies in advance)
What if the hotkey feature was in the core offer of the software rather than plugin's feature, wouldn't that work well?
and with reference to my case, once the hotkey is clicked it runs the code in the current visible terminal at that moment. No matter how many terminals are open.

Posted: 24.07.2022 05:37
by main Alexey
Ok, to put in the currently visible terminal - it makes sence. ie makes more sence.

if you are learning python--
1- ExtTools
https://wiki.lazarus.freepascal.org/Cud ... on_scripts
2- Runner
https://wiki.lazarus.freepascal.org/Cud ... for_Python
3- LSP
https://wiki.lazarus.freepascal.org/Cud ... for_Python
or alternative to LSP - 'Python IntelliSense' plg.