[Scilab-users] Scilab 6 problem with "Prettify"

classic Classic list List threaded Threaded
26 messages Options
12
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Scilab 6 problem with "Prettify"

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Pierre Vuillemin Pierre Vuillemin
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

Dear Claus,

I've not experienced any issue on Scilab 6 so far with this routine.

If this error shows up even if the code is not executed then the error may come from elsewhere? I've had some issues with Scilab 6 error messages pointing out the wrong chunk of code.

The "invalid buffer" message may indicate that there is a problem during the first run. I would start by investigating this part.

Best regards,

Pierre

Le 06.09.2017 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

In reply to this post by Claus Futtrup
Hello Claus,
In Scilab, clear is deleterious. As a first hint, i would try commenting it before rerunning  the script.
Best regards
Samuel

Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

Hi Samuel, et al.

Thanks for the tip, I commented "// clear;" - so this is no longer executed.

First script run still generate the "Invalid buffer." error - and second run still generate the line 93 error.

This level of debugging is not my strong side. Sorry.

This is really weird. I modified my script so that the first line executed is "disp("hello1");" ... I never see this message displayed, only the below error. The only thing that "works" is to close down and restart Scilab.

P.S. I believe I looked through the changes to 6.0 to ensure that I wasn't using any functions that cannot work under 6.0, but I might have failed. Is there a tool which can parse a script and give advice?

Best regards,
Claus

On 07-09-2017 21:25, Samuel Gougeon wrote:
Hello Claus,
In Scilab, clear is deleterious. As a first hint, i would try commenting it before rerunning  the script.
Best regards
Samuel

Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

In reply to this post by Samuel GOUGEON
Hi Samuel

About "clear" I looked and it's still a documented feature in 6.0:
https://help.scilab.org/docs/6.0.0/en_US/clear.html

I also revisited the 6.0 Release Notes (PDF) and it lists only these as obsolete:
Obsolete functions or features w maxfiles is now obsolete.
w isoview(xmin,xmax,ymin,ymax) is deprecated. Please use isoview("on"), replot(..) instead.
w eval3d will be removed from Scilab 6.1. Please use ndgrid instead.
w strcmpi is deprecated. Please use strcmp(..,"i")instead.
w square will be removed from Scilab 6.1. Please use gcf().axes_ size and replot instead.

... You might be right that clear is on its way out, but I don't know where to find the information.

/Claus

On 07-09-2017 21:25, Samuel Gougeon wrote:
Hello Claus,
In Scilab, clear is deleterious. As a first hint, i would try commenting it before rerunning  the script.
Best regards
Samuel

Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

In reply to this post by Samuel GOUGEON
Hi all

The "Invalid buffer." message becomes even weirder. It is not in the list of error messages:
https://help.scilab.org/docs/6.0.0/en_US/error_table.html

I guarantee it's not an error message I've made up myself. The entire script does not contain the word "buffer" (or "buffer.") anywhere.

/Claus

On 07-09-2017 21:25, Samuel Gougeon wrote:
Hello Claus,
In Scilab, clear is deleterious. As a first hint, i would try commenting it before rerunning  the script.
Best regards
Samuel

Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Pierre Vuillemin Pierre Vuillemin
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

Hi Claus,

You need to spot where the 'invalid buffer' message comes from. Adding 'pause' statements throughout your script may help you (or is there a debugging step by step tool? I don't know). Or you may want to comment suspicious parts of your code until there is no more error....

Do you read data at some point? I would intuitively suspect such a message to be related to some data input/data reading operation but I may be mistaken.

Besides, I've encountered a similar behaviour where Scilab 6 seems to work during the first run of a script but then something goes wrong and nothing works quite right anymore (like error messages out of the place) until Scilab is restarted. At this point I find this version quite unstable.


Pierre


Le 07/09/2017 à 21:55, Claus Futtrup a écrit :
Hi all

The "Invalid buffer." message becomes even weirder. It is not in the list of error messages:
https://help.scilab.org/docs/6.0.0/en_US/error_table.html

I guarantee it's not an error message I've made up myself. The entire script does not contain the word "buffer" (or "buffer.") anywhere.

/Claus

On 07-09-2017 21:25, Samuel Gougeon wrote:
Hello Claus,
In Scilab, clear is deleterious. As a first hint, i would try commenting it before rerunning  the script.
Best regards
Samuel

Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

In reply to this post by Claus Futtrup
Claus,

I might have been unclear about clear(). I meant
--> clear  // clears everything, even all user defined functions and libraries
is deleterious. I do not really understand how you could use prettify() if it is not in a protected autoloaded ATOMS library, since it will be deleted by your "clear" statement, with all other things?
 
clear() is useful to delete an explicit set of given variables. There is no project about removing it.

About your issue: may be it's time to use the new debug() debugger :)
It is hard to help without being able to see and test the code (i don't ask for it ;)
So, IMO your best way would be using debug().

Cheers
Samuel

Le 07/09/2017 à 21:51, Claus Futtrup a écrit :
Hi Samuel

About "clear" I looked and it's still a documented feature in 6.0:
https://help.scilab.org/docs/6.0.0/en_US/clear.html

I also revisited the 6.0 Release Notes (PDF) and it lists only these as obsolete:
Obsolete functions or features w maxfiles is now obsolete.
w isoview(xmin,xmax,ymin,ymax) is deprecated. Please use isoview("on"), replot(..) instead.
w eval3d will be removed from Scilab 6.1. Please use ndgrid instead.
w strcmpi is deprecated. Please use strcmp(..,"i")instead.
w square will be removed from Scilab 6.1. Please use gcf().axes_ size and replot instead.

... You might be right that clear is on its way out, but I don't know where to find the information.

/Claus

On 07-09-2017 21:25, Samuel Gougeon wrote:
Hello Claus,
In Scilab, clear is deleterious. As a first hint, i would try commenting it before rerunning  the script.
Best regards
Samuel

Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

In reply to this post by Claus Futtrup
Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Weird errors sometimes occur after copying/pasting some code from a rich text formated document to Scinotes or the console. Some usual characters like the space or quotes may have some special encoding in formated text, and keep it in Scinotes, but are not aknowledged by the parser.
The last time i got this situation, it was about spaces  that looked like spaces, but that were not ascii(32). To avoid this, i pasted the text in a raw text unformated .txt file before copying/pasting in Scinotes.

HTH
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

Le 07/09/2017 à 23:14, Samuel Gougeon a écrit :
Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Weird errors sometimes occur after copying/pasting some code from a rich text formated document to Scinotes or the console. Some usual characters like the space or quotes may have some special encoding in formated text, and keep it in Scinotes, but are not aknowledged by the parser.
The last time i got this situation, it was about spaces  that looked like spaces, but that were not ascii(32). To avoid this, i pasted the text in a raw text unformated .txt file before copying/pasting in Scinotes.


If you have copied/pasted some code directly from the web (like Pierre's Github page), it could be a source of encoding bugs: Web pages often use unbreakable spaces (  in HTML). I am pretty sure that Scilab's parser doesn't like them.


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Christophe Dang Ngoc Chan Christophe Dang Ngoc Chan
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} Re: Scilab 6 problem with "Prettify"

In reply to this post by Pierre Vuillemin
Hello,

> De : Pierre Vuillemin
> Envoyé : jeudi 7 septembre 2017 22:20
>
> Or you may want to comment suspicious parts of your code until there is no more error....

A very efficient way to isolate the error is to use dichotomy.

Normally, the core of your script should consist in calling functions.
So remove the first half of the functions and see if you get the error.
If not, remove the other half.
You can then isolate in which half your function is.
Remove then the first half of the problematic half etc.

If both fail, then the problematic part is in the core
And you can isolate it in the same way.

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

In reply to this post by Pierre Vuillemin
Hi Pierre

>At this point I find this version quite unstable.

Yes. If I don't find a solution, I'll have to revert to Scilab 5.5 ... but 6.0 is so much faster with graphics, so I'll continue a bit to see what's the problem.

Best regards,
Claus

On 07-09-2017 22:20, Pierre Vuillemin wrote:

Hi Claus,

You need to spot where the 'invalid buffer' message comes from. Adding 'pause' statements throughout your script may help you (or is there a debugging step by step tool? I don't know). Or you may want to comment suspicious parts of your code until there is no more error....

Do you read data at some point? I would intuitively suspect such a message to be related to some data input/data reading operation but I may be mistaken.

Besides, I've encountered a similar behaviour where Scilab 6 seems to work during the first run of a script but then something goes wrong and nothing works quite right anymore (like error messages out of the place) until Scilab is restarted. At this point I find this version quite unstable.


Pierre


Le 07/09/2017 à 21:55, Claus Futtrup a écrit :
Hi all

The "Invalid buffer." message becomes even weirder. It is not in the list of error messages:
https://help.scilab.org/docs/6.0.0/en_US/error_table.html

I guarantee it's not an error message I've made up myself. The entire script does not contain the word "buffer" (or "buffer.") anywhere.

/Claus

On 07-09-2017 21:25, Samuel Gougeon wrote:
Hello Claus,
In Scilab, clear is deleterious. As a first hint, i would try commenting it before rerunning  the script.
Best regards
Samuel

Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

In reply to this post by Samuel GOUGEON
Hi Samuel

OK, I see - regarding clear.

Yes, maybe the new debugger could be helpful.

The code is not top-secret, but to test the complete code in a meaningful way I'd need to also include 40 kb of data... so it's best to share with private email to whom wish to help me out.

P.S. The tip with copy-paste from "rich" source could indeed be the problem. I don't know (and don't remember) ... but it works fine in Scilab 5.5.

Best regards,
Claus

On 07-09-2017 22:53, Samuel Gougeon wrote:
Claus,

I might have been unclear about clear(). I meant
--> clear  // clears everything, even all user defined functions and libraries
is deleterious. I do not really understand how you could use prettify() if it is not in a protected autoloaded ATOMS library, since it will be deleted by your "clear" statement, with all other things?
 
clear() is useful to delete an explicit set of given variables. There is no project about removing it.

About your issue: may be it's time to use the new debug() debugger :)
It is hard to help without being able to see and test the code (i don't ask for it ;)
So, IMO your best way would be using debug().

Cheers
Samuel

Le 07/09/2017 à 21:51, Claus Futtrup a écrit :
Hi Samuel

About "clear" I looked and it's still a documented feature in 6.0:
https://help.scilab.org/docs/6.0.0/en_US/clear.html

I also revisited the 6.0 Release Notes (PDF) and it lists only these as obsolete:
Obsolete functions or features w maxfiles is now obsolete.
w isoview(xmin,xmax,ymin,ymax) is deprecated. Please use isoview("on"), replot(..) instead.
w eval3d will be removed from Scilab 6.1. Please use ndgrid instead.
w strcmpi is deprecated. Please use strcmp(..,"i")instead.
w square will be removed from Scilab 6.1. Please use gcf().axes_ size and replot instead.

... You might be right that clear is on its way out, but I don't know where to find the information.

/Claus

On 07-09-2017 21:25, Samuel Gougeon wrote:
Hello Claus,
In Scilab, clear is deleterious. As a first hint, i would try commenting it before rerunning  the script.
Best regards
Samuel

Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

In reply to this post by Samuel GOUGEON
Hi Samuel

Good points with the "rich" text. I don't know how to locate these.

If Scinotes / Scilab 6.0 is sensitive to this, could it maybe include a "cleaner" for such stuff?

Best regards,
Claus

On 08-09-2017 00:25, Samuel Gougeon wrote:
Le 07/09/2017 à 23:14, Samuel Gougeon a écrit :
Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Weird errors sometimes occur after copying/pasting some code from a rich text formated document to Scinotes or the console. Some usual characters like the space or quotes may have some special encoding in formated text, and keep it in Scinotes, but are not aknowledged by the parser.
The last time i got this situation, it was about spaces  that looked like spaces, but that were not ascii(32). To avoid this, i pasted the text in a raw text unformated .txt file before copying/pasting in Scinotes.


If you have copied/pasted some code directly from the web (like Pierre's Github page), it could be a source of encoding bugs: Web pages often use unbreakable spaces (  in HTML). I am pretty sure that Scilab's parser doesn't like them.



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} Re: Scilab 6 problem with "Prettify"

In reply to this post by Christophe Dang Ngoc Chan
Hi Christophe

Good points. I guess one thing I could do is to delete the entire
Prettify from my file (and not call Prettify). Then see if Scilab 6
complains.

It's weird, though, that the errors are prior to execution of any code.
I guess Scilab first "reads" the entire code somehow and if there's
anything less than perfect, it breaks and cannot start stepping through
the code.

/Claus

On 08-09-2017 09:43, Dang Ngoc Chan, Christophe wrote:

> Hello,
>
>> De : Pierre Vuillemin
>> Envoyé : jeudi 7 septembre 2017 22:20
>>
>> Or you may want to comment suspicious parts of your code until there is no more error....
> A very efficient way to isolate the error is to use dichotomy.
>
> Normally, the core of your script should consist in calling functions.
> So remove the first half of the functions and see if you get the error.
> If not, remove the other half.
> You can then isolate in which half your function is.
> Remove then the first half of the problematic half etc.
>
> If both fail, then the problematic part is in the core
> And you can isolate it in the same way.
>
> Regards
>
> --
> Christophe Dang Ngoc Chan
> Mechanical calculation engineer
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

In reply to this post by Samuel GOUGEON
Hi Samuel

>I do not really understand how you could use prettify() if it is not in a protected autoloaded ATOMS library

For potential easy distribution of the code, I do not include any requirement of any ATOMS modules, just clean Scilab installation is expected and everything is contained in a single .sce file.

Since Prettify code was released as source code in a way, I have copied the entire text into my mainline-script. Hence the functions are loaded each time I run the code. The code includes the authorship / code ownership of Pierre Vuillemin and mentions the BSD license that comes with it. It's in my mainline script from line 47 to line 231.

To the best of my knowledge Prettify is currently not available as an ATOMS module. Am I right?

Best regards,
Claus

On 07-09-2017 22:53, Samuel Gougeon wrote:
Claus,

I might have been unclear about clear(). I meant
--> clear  // clears everything, even all user defined functions and libraries
is deleterious. I do not really understand how you could use prettify() if it is not in a protected autoloaded ATOMS library, since it will be deleted by your "clear" statement, with all other things?
 
clear() is useful to delete an explicit set of given variables. There is no project about removing it.

About your issue: may be it's time to use the new debug() debugger :)
It is hard to help without being able to see and test the code (i don't ask for it ;)
So, IMO your best way would be using debug().

Cheers
Samuel

Le 07/09/2017 à 21:51, Claus Futtrup a écrit :
Hi Samuel

About "clear" I looked and it's still a documented feature in 6.0:
https://help.scilab.org/docs/6.0.0/en_US/clear.html

I also revisited the 6.0 Release Notes (PDF) and it lists only these as obsolete:
Obsolete functions or features w maxfiles is now obsolete.
w isoview(xmin,xmax,ymin,ymax) is deprecated. Please use isoview("on"), replot(..) instead.
w eval3d will be removed from Scilab 6.1. Please use ndgrid instead.
w strcmpi is deprecated. Please use strcmp(..,"i")instead.
w square will be removed from Scilab 6.1. Please use gcf().axes_ size and replot instead.

... You might be right that clear is on its way out, but I don't know where to find the information.

/Claus

On 07-09-2017 21:25, Samuel Gougeon wrote:
Hello Claus,
In Scilab, clear is deleterious. As a first hint, i would try commenting it before rerunning  the script.
Best regards
Samuel

Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Follow-up Re: {EXT} Re: Scilab 6 problem with "Prettify"

In reply to this post by Claus Futtrup
Hi all

First follow-up. I completely removed the entire section of Prettify
code, and all instances of calls to the prettify function was commented
out. This executes fine in Scilab 5.5.

In Scilab 6 I still get the "Invalid buffer." response, but now it can
execute repeatedly. I just gotta chase down what buffer, etc. ... you
know, the error which is not listed in the error table:
https://help.scilab.org/docs/6.0.0/en_US/error_table.html

Best regards,
Claus

On 08-09-2017 16:48, Claus Futtrup wrote:

> Hi Christophe
>
> Good points. I guess one thing I could do is to delete the entire
> Prettify from my file (and not call Prettify). Then see if Scilab 6
> complains.
>
> It's weird, though, that the errors are prior to execution of any
> code. I guess Scilab first "reads" the entire code somehow and if
> there's anything less than perfect, it breaks and cannot start
> stepping through the code.
>
> /Claus
>
> On 08-09-2017 09:43, Dang Ngoc Chan, Christophe wrote:
>> Hello,
>>
>>> De : Pierre Vuillemin
>>> Envoyé : jeudi 7 septembre 2017 22:20
>>>
>>> Or you may want to comment suspicious parts of your code until there
>>> is no more error....
>> A very efficient way to isolate the error is to use dichotomy.
>>
>> Normally, the core of your script should consist in calling functions.
>> So remove the first half of the functions and see if you get the error.
>> If not, remove the other half.
>> You can then isolate in which half your function is.
>> Remove then the first half of the problematic half etc.
>>
>> If both fail, then the problematic part is in the core
>> And you can isolate it in the same way.
>>
>> Regards
>>
>> --
>> Christophe Dang Ngoc Chan
>> Mechanical calculation engineer
>> This e-mail may contain confidential and/or privileged information.
>> If you are not the intended recipient (or have received this e-mail
>> in error), please notify the sender immediately and destroy this
>> e-mail. Any unauthorized copying, disclosure or distribution of the
>> material in this e-mail is strictly forbidden.
>> _______________________________________________
>> users mailing list
>> [hidden email]
>> http://lists.scilab.org/mailman/listinfo/users
>>
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: Follow-up Re: {EXT} Re: Scilab 6 problem with "Prettify"

Hi all

I see Scinotes supports "Execute file with echo" ... so I did that (and
stopped the execution in its tracks). This is the code which gives me an
invalid buffer error:

--> // ---- Change active directory to script directory ----
--> [units,typs,nams]=file(); // nams(1) = script file name incl. path
--> fpathname=strsplit(nams(1), [filesep()]); // disp(b($-1));
--> scriptpath = get_absolute_file_path(fpathname($));
--> chdir(scriptpath);
Invalid buffer.
--> // ---- READ CONFIG FILE ----

The scriptpath variable is empty. When I look at the commands, it seems
the logic has changes since 5.5 so that instead of nams(1) one should
use nams(2) instead, but nams(2) doesn't contain the script path.
Instead (on Windows 10) it contains a link to a temporary file in
AppData/Local/Temp ... and the file is named (randomly, I suppose):
LOAD_INTO_SCILAB-17 84290624451915792.sce

So - please let me know, how do I now determine where my script is
located? (So that I can save output data to the same folder)

Thanks.

P.S. It seems I still have an unresolved problem with the Prettify code
that I've copied into my script. I wonder if Pierre Vuillemin is willing
to help by providing suitable code for Scilab 6 - and please let me know
where (and how) to pick it up without errors.

/Claus

On 08-09-2017 19:47, Claus Futtrup wrote:

> Hi all
>
> First follow-up. I completely removed the entire section of Prettify
> code, and all instances of calls to the prettify function was
> commented out. This executes fine in Scilab 5.5.
>
> In Scilab 6 I still get the "Invalid buffer." response, but now it can
> execute repeatedly. I just gotta chase down what buffer, etc. ... you
> know, the error which is not listed in the error table:
> https://help.scilab.org/docs/6.0.0/en_US/error_table.html
>
> Best regards,
> Claus
>
> On 08-09-2017 16:48, Claus Futtrup wrote:
>> Hi Christophe
>>
>> Good points. I guess one thing I could do is to delete the entire
>> Prettify from my file (and not call Prettify). Then see if Scilab 6
>> complains.
>>
>> It's weird, though, that the errors are prior to execution of any
>> code. I guess Scilab first "reads" the entire code somehow and if
>> there's anything less than perfect, it breaks and cannot start
>> stepping through the code.
>>
>> /Claus
>>
>> On 08-09-2017 09:43, Dang Ngoc Chan, Christophe wrote:
>>> Hello,
>>>
>>>> De : Pierre Vuillemin
>>>> Envoyé : jeudi 7 septembre 2017 22:20
>>>>
>>>> Or you may want to comment suspicious parts of your code until
>>>> there is no more error....
>>> A very efficient way to isolate the error is to use dichotomy.
>>>
>>> Normally, the core of your script should consist in calling functions.
>>> So remove the first half of the functions and see if you get the error.
>>> If not, remove the other half.
>>> You can then isolate in which half your function is.
>>> Remove then the first half of the problematic half etc.
>>>
>>> If both fail, then the problematic part is in the core
>>> And you can isolate it in the same way.
>>>
>>> Regards
>>>
>>> --
>>> Christophe Dang Ngoc Chan
>>> Mechanical calculation engineer
>>> This e-mail may contain confidential and/or privileged information.
>>> If you are not the intended recipient (or have received this e-mail
>>> in error), please notify the sender immediately and destroy this
>>> e-mail. Any unauthorized copying, disclosure or distribution of the
>>> material in this e-mail is strictly forbidden.
>>> _______________________________________________
>>> users mailing list
>>> [hidden email]
>>> http://lists.scilab.org/mailman/listinfo/users
>>>
>>
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: Follow-up Re: {EXT} Re: Scilab 6 problem with "Prettify"

Hi all

At the moment the problem has resolved itself. The below code now
correctly gives me the script path.

I have no idea what happened. The code is the same. Maybe a Windows-10
"burp" and after a reboot it's fixed (??). Since we've talked about this
yesterday (and the computer is turned off overnight) it wasn't just due
to a reboot alone (since the problem was persistent today also), but
alas, at the moment the script works. It shall be interesting to see if
it also works tomorrow.

Best regards,
Claus

On 08-09-2017 19:57, Claus Futtrup wrote:

> Hi all
>
> I see Scinotes supports "Execute file with echo" ... so I did that
> (and stopped the execution in its tracks). This is the code which
> gives me an invalid buffer error:
>
> --> // ---- Change active directory to script directory ----
> --> [units,typs,nams]=file(); // nams(1) = script file name incl. path
> --> fpathname=strsplit(nams(1), [filesep()]); // disp(b($-1));
> --> scriptpath = get_absolute_file_path(fpathname($));
> --> chdir(scriptpath);
> Invalid buffer.
> --> // ---- READ CONFIG FILE ----
>
> The scriptpath variable is empty. When I look at the commands, it
> seems the logic has changes since 5.5 so that instead of nams(1) one
> should use nams(2) instead, but nams(2) doesn't contain the script
> path. Instead (on Windows 10) it contains a link to a temporary file
> in AppData/Local/Temp ... and the file is named (randomly, I suppose):
> LOAD_INTO_SCILAB-17 84290624451915792.sce
>
> So - please let me know, how do I now determine where my script is
> located? (So that I can save output data to the same folder)
>
> Thanks.
>
> P.S. It seems I still have an unresolved problem with the Prettify
> code that I've copied into my script. I wonder if Pierre Vuillemin is
> willing to help by providing suitable code for Scilab 6 - and please
> let me know where (and how) to pick it up without errors.
>
> /Claus
>
> On 08-09-2017 19:47, Claus Futtrup wrote:
>> Hi all
>>
>> First follow-up. I completely removed the entire section of Prettify
>> code, and all instances of calls to the prettify function was
>> commented out. This executes fine in Scilab 5.5.
>>
>> In Scilab 6 I still get the "Invalid buffer." response, but now it
>> can execute repeatedly. I just gotta chase down what buffer, etc. ...
>> you know, the error which is not listed in the error table:
>> https://help.scilab.org/docs/6.0.0/en_US/error_table.html
>>
>> Best regards,
>> Claus
>>
>> On 08-09-2017 16:48, Claus Futtrup wrote:
>>> Hi Christophe
>>>
>>> Good points. I guess one thing I could do is to delete the entire
>>> Prettify from my file (and not call Prettify). Then see if Scilab 6
>>> complains.
>>>
>>> It's weird, though, that the errors are prior to execution of any
>>> code. I guess Scilab first "reads" the entire code somehow and if
>>> there's anything less than perfect, it breaks and cannot start
>>> stepping through the code.
>>>
>>> /Claus
>>>
>>> On 08-09-2017 09:43, Dang Ngoc Chan, Christophe wrote:
>>>> Hello,
>>>>
>>>>> De : Pierre Vuillemin
>>>>> Envoyé : jeudi 7 septembre 2017 22:20
>>>>>
>>>>> Or you may want to comment suspicious parts of your code until
>>>>> there is no more error....
>>>> A very efficient way to isolate the error is to use dichotomy.
>>>>
>>>> Normally, the core of your script should consist in calling functions.
>>>> So remove the first half of the functions and see if you get the
>>>> error.
>>>> If not, remove the other half.
>>>> You can then isolate in which half your function is.
>>>> Remove then the first half of the problematic half etc.
>>>>
>>>> If both fail, then the problematic part is in the core
>>>> And you can isolate it in the same way.
>>>>
>>>> Regards
>>>>
>>>> --
>>>> Christophe Dang Ngoc Chan
>>>> Mechanical calculation engineer
>>>> This e-mail may contain confidential and/or privileged information.
>>>> If you are not the intended recipient (or have received this e-mail
>>>> in error), please notify the sender immediately and destroy this
>>>> e-mail. Any unauthorized copying, disclosure or distribution of the
>>>> material in this e-mail is strictly forbidden.
>>>> _______________________________________________
>>>> users mailing list
>>>> [hidden email]
>>>> http://lists.scilab.org/mailman/listinfo/users
>>>>
>>>
>>
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6 problem with "Prettify"

In reply to this post by Pierre Vuillemin
Hi Pierre, et al.

I was able to resolve the problem with the Prettify code by changing ' to " in the code for default_options.

I have no idea why this should matter. AFAIR Scilab accepts both (just not mixed anymore - and there's no mix-up in the code). Just to prevent confusion, here's the code change which works for me (at the moment, again, we'll see tomorrow if the fix continues to work):

default_options = struct("title_font_size"   ,  4,...
                         "labels_font_size"  ,  3,...
                         "thicks_font_size"  ,  2,...
                         "num_format"        ,  '',...
                         "leg_font_size"     ,  3,...
                         "line_thickness"    ,  2,...
                         "xstring_font_size" ,  2);
//   default_options = struct('title_font_size'   ,  4,...
//                            'labels_font_size'  ,  3,...
//                            'thicks_font_size'  ,  2,...
//                            'num_format'        ,  '',...
//                            'leg_font_size'     ,  3,...
//                            'line_thickness'    ,  2,...
//                            'xstring_font_size' ,  2)

Best regards,
Claus

On 07-09-2017 22:20, Pierre Vuillemin wrote:

Hi Claus,

You need to spot where the 'invalid buffer' message comes from. Adding 'pause' statements throughout your script may help you (or is there a debugging step by step tool? I don't know). Or you may want to comment suspicious parts of your code until there is no more error....

Do you read data at some point? I would intuitively suspect such a message to be related to some data input/data reading operation but I may be mistaken.

Besides, I've encountered a similar behaviour where Scilab 6 seems to work during the first run of a script but then something goes wrong and nothing works quite right anymore (like error messages out of the place) until Scilab is restarted. At this point I find this version quite unstable.


Pierre


Le 07/09/2017 à 21:55, Claus Futtrup a écrit :
Hi all

The "Invalid buffer." message becomes even weirder. It is not in the list of error messages:
https://help.scilab.org/docs/6.0.0/en_US/error_table.html

I guarantee it's not an error message I've made up myself. The entire script does not contain the word "buffer" (or "buffer.") anywhere.

/Claus

On 07-09-2017 21:25, Samuel Gougeon wrote:
Hello Claus,
In Scilab, clear is deleterious. As a first hint, i would try commenting it before rerunning  the script.
Best regards
Samuel

Le 06/09/2017 à 21:33, Claus Futtrup a écrit :

Hi there

I've started to use the prettify functions by Pierre Vuillemin. So far so good in Scilab 5.5

Now I've started to look into Scilab 6 (not least because graphics is much faster), but I get a weird error.

If I start Scilab, first time I execute the code, I get an "Invalid buffer." message.

Second time I execute the code then I get a bad message:


--> exec('C:\Users\claus\Documents\Scilab54\z3mfit.sce', -1)
at line    93 of executed file C:\Users\claus\Documents\Scilab54\z3mfit.sce

                            'labels_font_size'  ,  3,...
                            ^^
Error: syntax error, unexpected "'", expecting "," or )


When I run my script, the first thing my code does - it clears all variables, all graphics and clears console, so it's not "old" stuff from previous run that is the problem. Or ???

The "line 93" is part of the default options in Prettify, where it says labels_font_size. It looks like this:

default_options = struct('title_font_size'   ,  4,...
                         'labels_font_size'  ,  3,...
                         'thicks_font_size'  ,  2,...
                         'num_format'        ,  '',...
                         'leg_font_size'     ,  3,...
                         'line_thickness'    ,  2,...
                         'xstring_font_size' ,  2)

Can anyone spot, what is the problem?

P.S. This part of the code is in a section that is controlled by an if-statement, and even if I make sure the condition is false (so that the Prettify code is not executed), Scilab still spits out this error. It's really weird - and even weirder it doesn't get the error the first time that the code is executed.

P.S. My entire code is ca. 915 lines long + requires input data, so I prefer not to attach it to a post here in the mailing list.

Best regards,

Claus




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
12