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

Claus Futtrup cfuttrup at gmail.com
Fri Sep 8 21:43:19 CEST 2017


Hi all

Oh, BTW, I forgot. The problem with nams(1) in Scilab 5 = nams(2) in 
Scilab 6 persist, so the code now looks like this:

[units,typs,nams]=file();  // nams(1) = script file name incl. path
version  =  evstr(part(getversion(),[8]));
if  version<6  then
     fpathname=strsplit(nams(1),  [filesep()]);
else
     fpathname=strsplit(nams(2),  [filesep()]);
end
scriptpath  =  get_absolute_file_path(fpathname($));
chdir(scriptpath);


As you can see, I now check for the Scilab version, then pick the proper 
part of the nams variable.

/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
>>>> users at lists.scilab.org
>>>> http://lists.scilab.org/mailman/listinfo/users
>>>>
>>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170908/36a30595/attachment.htm>


More information about the users mailing list