Error when .py file run in CudaText
-
- Posts: 5
- Joined: 22.07.2022 12:03
Error when .py file run in CudaText
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,
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,
-
- Posts: 2300
- Joined: 25.08.2021 18:15
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:
- (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.
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)
- 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.
-
- Posts: 2300
- Joined: 25.08.2021 18:15
Just saved this info to the Wiki,
https://wiki.freepascal.org/CudaText_plugins#Terminal
https://wiki.freepascal.org/CudaText_plugins#Terminal
-
- Posts: 5
- Joined: 22.07.2022 12:03
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.
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.
-
- Posts: 2300
- Joined: 25.08.2021 18:15
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.
There is alternative, Runner:
https://wiki.lazarus.freepascal.org/Cud ... ins#Runner
It also don't have such option.
-
- Posts: 5
- Joined: 22.07.2022 12:03
-
- Posts: 2300
- Joined: 25.08.2021 18:15
-
- Posts: 2300
- Joined: 25.08.2021 18:15
-
- Posts: 5
- Joined: 22.07.2022 12:03
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.
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.
-
- Posts: 2300
- Joined: 25.08.2021 18:15
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.
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.