General copied/pasted code errors

I don’t have much experience in supercollider yet and I’m experiencing a rather annoying problem on a recent installation, when I copy and paste code regions from doc.sccode.org into the IDE and even when trying to run the examples directly from the IDE documentation panel , using Ctrl+Return. Some simple examples work without a problem but others give meaningless syntax errors. On the other hand, it runs correctly if the white space is removed from the code or, also, by rewriting it by hand. The installation of supercollider is automated through choco install tidal.

Do you have any idea what could be the cause of the errors? Thank you very much for the help

This sounds really strange :jack_o_lantern: !

Can you copy-paste one of the error message you get here, along with the code you are trying to run ?

Maybe some examples depend on a quark or a plugin which you haven’t installed.

To get help from other users, you need the internet address to the specific code.

In general, you can copy the code by clicking ‘copy’ button above the code:

Otherwise, you can select all code by pressing ctrl/cmd + a after clicking the box in raw:

Thank you for your interest and please forgive me for the lack of precision; I am referring to errors of this type when executing the following code:

// Scale segments, in the sequence: up, up, down (repeat)
(
TempoClock.default.tempo = 1;
p = Pbind(
    \degree, Pseq([
        Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),    // up (step = 1)
        Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),    // up (step = 1)
        Pseries({ rrand(7, 14) }, -1, { rrand(4, 8) })    // down (step = -1)
    ], inf),
    \dur, 0.125
).play;
)

Post window after booting the server and CTRL+Return the code:

Booting with:
  In: MME : Micrófono (Jabra EVOLVE 30 II)
  Out: MME : Altavoces (Jabra EVOLVE 30 II)
  Sample rate: 44100.000
  Latency (in/out): 0.013 / 0.091 sec
SC_AudioDriver: sample rate = 44100.000000, driver's block size = 64
SuperCollider 3 server ready.
Requested notification messages from server 'localhost'
localhost: server process's maxLogins (1) matches with my options.
localhost: keeping clientID (0) as confirmed by server process.
Shared memory server interface initialized
ERROR: syntax error, unexpected ')', expecting DOTDOT
  in interpreted text
  line 1 char 6:

  (4, 8) })    // down (step = -1)
       ^
      ], inf),
-----------------------------------
ERROR: Command line parse failed
-> nil

The example is extracted from this guide Pattern Guide 04: Words to Phrases | SuperCollider 3.12.2 Help

By removing pof the whitespace in one line, the error changes:

// Scale segments, in the sequence: up, up, down (repeat)
(
TempoClock.default.tempo = 1;
p = Pbind(\degree, Pseq([Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),    // up (step = 1)
        Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),    // up (step = 1)
        Pseries({ rrand(7, 14) }, -1, { rrand(4, 8) })    // down (step = -1)
    ], inf),
    \dur, 0.125
).play;
)
ERROR: syntax error, unexpected BINOP, expecting $end
  in interpreted text
  line 1 char 1:

  / down (step = -1)
  ^
      ], inf),
-----------------------------------
ERROR: Command line parse failed
-> nil

and finally, removing all the whitespace (including comments) the code executes the EventStreamPlayer correctly.

Does it make a difference where the cursor is placed when you hit ctrl-return? That is, does the specific part of the code shown in the syntax error message change, or is it always exactly as shown?

hjh

It’s difficult to see where the error comes from. The code runs fine on my system, so it could be OS related.

Do you still have the error when running the following (comment are removed) :

(
TempoClock.default.tempo = 1;
p = Pbind(
    \degree, Pseq([
        Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),
        Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),
        Pseries({ rrand(7, 14) }, -1, { rrand(4, 8) })
    ], inf),
    \dur, 0.125
).play;
)

Do you still have the error when running the following (indentation is tab characters instead of space characters) :

(
TempoClock.default.tempo = 1;
p = Pbind(
	\degree, Pseq([
		Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),
		Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),
		Pseries({ rrand(7, 14) }, -1, { rrand(4, 8) })
	], inf),
	\dur, 0.125
).play;
)

For all the tests I have done it does not matter the position of the cursor, you always get the same error message; and in all cases the complete and correct region of code flashes when hitting ctrl+return

Looks very similar to this issue: Code stops working after hitting 252 characters · Issue #6081 · supercollider/supercollider · GitHub

i.e. interprocess communication between IDE and language client is broken somehow.

1 Like

Perhaps this SuperCollider build has a problem?

That’s right @Dindoleon !

The error persists when comments are removed, but it works fine when they are removed AND regular space characters are replaced by indentation tab.

The enigmatic thing is that, once it starts working with these fixes, subsequent executions of the code that previously failed, surprisingly always works, without any additional fixes, until the moment the server is restarted, then the cycle repeats.
That is: directly pasting the first fragment of your code does not work, pasting the second fragment does, and re-executing the first fragment again, now it also works.

I have Windows 10 Pro installed and updated, in a previous fresh instalation I had the same casuistry…

Thank you very much for your interest and help!

1 Like

Thanks a lot for the feedback. At least you have a way to ‘fix’ it. But we’ll have to investigate further to see where the error comes from.

I’m afraid that the error is related to what is discussed in this other post Evaluation problem on Windows. In my case I am experiencing similar errors when creating new files and saving files. Unfortunately no solution was found in this regard.

Post window when creating new file (CTRL+N):

ERROR: syntax error, unexpected NAME, expecting $end
  in interpreted text
  line 1 char 23:

  -4413-8450-75052c9e84c8}');ScIDE.currentPath_(nil); 
                  ^^^^^^^
-----------------------------------
ERROR: Command line parse failed

Post window when Saving file:

WARNING: Attempted to modify missing Text Mirror for Document {e4b9c291-d420-4413-8450-75052c9e84c8}
ERROR: syntax error, unexpected ',', expecting $end
  in interpreted text
  line 1 char 1:

  ,110,100,32,108,105,110,101,32,112,97,114,115,101,32,102,97,105,108,101,100,10,10,10,10,10,10,10,], 0, [67,58,47,116,109,112,47,115,103,97,115,100,46,115,99,100,], 249, 0) 
  ^
-----------------------------------
ERROR: Command line parse failed

Also, after this errors I get this error in the Post Window when pasting some text in the IDE:

WARNING: Attempted to modify missing Text Mirror for Document {e4b9c291-d420-4413-8450-75052c9e84c8}
ERROR: Message 'prSetEdited' not understood.
RECEIVER:
   nil
ARGS:
   Integer 1
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Object:doesNotUnderstand
		arg this = nil
		arg selector = 'prSetEdited'
		arg args = [*1]
	Process:interpretCmdLine
		arg this = <instance of Main>
^^ ERROR: Message 'prSetEdited' not understood.
RECEIVER: nil

By the way thanks for your time, answers and interest!

Does the linked video in the following thread in the issues section for SuperCollider on github show your problem?

It would seem that the ScIDE class fails to initialize properly.

It feels like when initializing, it interprets a string at some point, which somehow leaves a parenthesis or similar open. Then, later, it tries to interpret an other string, encounters a character that shouldn’t be present until what it opened previously was closed, thus raising an error.

I might be wrong, but I think that this might be related to the communication with the OS, and specifically, with Windows OS. Maybe when trying to access a path, it gets a collision between a character and an opening parenthesis instruction ? What is your locale language ? Are the path of your SuperCollider folders (both SC install folder and saved projects folder) containing white spaces, or accentuated characters ?

yes @prko, that is the case.

My locale is Spanish (Spain)
Paths:
C:\Users\lpeiro\AppData\Local\SuperCollider
C:\Program Files\SuperCollider-3.12.1

Could you try using after selecting “Beta: Use Unicode UTF-8 for worldwide language support”?

It will not solve the problem, but it will reduce the frequency of the problem.

ok, thanks! I will try for a while; for the moment the problem persists :frowning:

Ah… I see this was reported before, in the other thread, but I overlooked an implication at that time.

I could imagine a couple of reasons for the class of error. One is that the IDE could be mis-identifying the boundaries of the code to execute. (That’s why I asked about cursor position – this cause might be sensitive to the cursor and/or selection.)

The other is incomplete transmission of the code to execute.

New document, copy/paste etc are running code that is generated by the IDE, not extracted from an open document. The fact that it’s happening for these as well as for code that you wrote means that it can only be a transmission bug. So, investigation can focus on the IPC layer. (Narrowing the scope of the investigation is very useful!)

Still unknown is why the same IDE/sclang source code doesn’t break in Mac and Linux, and doesn’t break in most Windows installs, but does break in some specific environments (with the same source code…). Boost problem maybe?

hjh