Incorrect Item: ['from cudatext import *'].

Solved bugs are moved into this topic...
Post Reply
Fayence
Posts: 3
Joined: 30.09.2020 08:48

Incorrect Item: ['from cudatext import *'].

Post by Fayence »

Hi there,
I am trying to create an own plugin to search/replace certain ascii chars in a textfile. So far, I have got a sample coding (see below) , but entering this (Menu Plugin - Make Plugin) I am receiving following error message after confirming the box:
Incorrect Item: ['from cudatext import *'].

Even if I have a look at a imported plugin (which is working and copy&paste some other lines as e.g. 'import cudatext as app' I will receive this as an error message as well.

I assume that something is missing ... ? Nevertheless: can anyone tell me what I have to do to get this plugin working ?
Thank you in advance for any help.

btw I am totally new to Cupatext ... and did not found any howto or something else.


Code I have:

Code: Select all

from cudatext import *

class Command:
    def run(self):
        s=ed.get_text_all()
        for i in range(32):
            if not i in [10,13,9]:
                s=s.replace(chr(i), '')
        ed.set_text_all(s)
User avatar
kvichans
Posts: 203
Joined: 07.10.2012 05:45

Post by kvichans »

The code will work only as Cuda plugin.
Do you run it outside?
CudaText 1.163, TC9.51x32, Win10x64(1920x1080)
Fayence
Posts: 3
Joined: 30.09.2020 08:48

Post by Fayence »

Hey,
I have installed cudatext on windows 10, and trying to implement the mentioned coding as a plugin (Menu Plugin - Make Plugin).
As soon the saving would be successfull, I would run this as a cudatext-plugin. But .. I cannot save this coding due to mentioned error message.
regards
User avatar
kvichans
Posts: 203
Joined: 07.10.2012 05:45

Post by kvichans »

> I cannot save this coding
Your problem is about saving or runnging?

What is the way do you "run the code"?

I know that way:
- Restart Cuda to update plugin list
- Call "Commands" palette (F1)
- Type "plugin <name of your plug>"
- Find and select in list "plugin: <name of your plug>: <name of your command in install.inf>"
- Enter
CudaText 1.163, TC9.51x32, Win10x64(1920x1080)
Fayence
Posts: 3
Joined: 30.09.2020 08:48

Post by Fayence »

Hi,

mentioned error message appears as soon as I want to save that coding. Via Menu Plugin - Make Plugin. Even if I reduce coding to first line "from cudatext import *" or any other line I have found in imported plugins e.g. 'import cudatext as app' I am receiving that Error Message with first line of plugin coding.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

>I have got a sample coding (see below) , but entering this (Menu Plugin - Make Plugin) I am receiving following error message after confirming the box:
Incorrect Item: ['from cudatext import *'].
did you enter Python code in the MakePlugin dialog input? no, don't enter it there. python code must be in the __init__.py.
MakePlugin will create the __init__.py.
Post Reply