I've got a very simple PythonScript to insert \r\n (with no auto-indentation), assigned to Control+M.
Sometimes, when I type Control+M two or more times in quick succession, I get the error in the topic title.
The problem, I guess, is that there's a brief delay while Python gets swapped back in to execute the script.
I'm not trying to run these scripts in parallel, I'm trying to run them in sequence. This error is a pain. Can't the invocations be queued?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In theory yes, and in fact, there's nothing stopping the two scripts running at the same time. The error message is there because although technically there is no issue with running two scripts simultaneously, I though that for the average user it could be dangerous - ie. I didn't want the average-joe user to have to think about multi-threading when writing his script to modify a bit of text.
I think it should be pretty easy to add some options to turn on a queuing or parallel script mode for the people that want it. Something like
notepad.setScriptMode(SCRIPTMODE.PARALLEL)
to run in startup.py. Obviously this isn't there yet, but it could go into the next version.
Thoughts?
Cheers,
Dave.
PS. Apologies for the month long wait for an answer on this - I've only just seen it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the case I'm talking about, I don't really want parallel; I want queued, serialized operation. In fact, that's likely to be my primary usage; I'm not running scripts based on hooks, just adding behaviors to trigger from keys.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've got a very simple PythonScript to insert \r\n (with no auto-indentation), assigned to Control+M.
Sometimes, when I type Control+M two or more times in quick succession, I get the error in the topic title.
The problem, I guess, is that there's a brief delay while Python gets swapped back in to execute the script.
I'm not trying to run these scripts in parallel, I'm trying to run them in sequence. This error is a pain. Can't the invocations be queued?
In theory yes, and in fact, there's nothing stopping the two scripts running at the same time. The error message is there because although technically there is no issue with running two scripts simultaneously, I though that for the average user it could be dangerous - ie. I didn't want the average-joe user to have to think about multi-threading when writing his script to modify a bit of text.
I think it should be pretty easy to add some options to turn on a queuing or parallel script mode for the people that want it. Something like
notepad.setScriptMode(SCRIPTMODE.PARALLEL)
to run in startup.py. Obviously this isn't there yet, but it could go into the next version.
Thoughts?
Cheers,
Dave.
PS. Apologies for the month long wait for an answer on this - I've only just seen it.
In the case I'm talking about, I don't really want parallel; I want queued, serialized operation. In fact, that's likely to be my primary usage; I'm not running scripts based on hooks, just adding behaviors to trigger from keys.