<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi all<br>
<br>
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:<br>
<br>
<pre style="font-family:Monospaced;font-style:normal;font-size:17.0;"><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(0,0,0);">units</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">typs</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">nams</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(50,185,185);">file</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// nams(1) = script file name incl. path</span>
<span style="color:rgb(0,0,0);">version</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(174,92,176);text-decoration:underline;">evstr</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(50,185,185);">part</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(50,185,185);">getversion</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">8</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(160,32,240);">if</span> <span style="color:rgb(0,0,0);">version</span><span style="color:rgb(92,92,92);"><</span><span style="color:rgb(188,143,143);">6</span> <span style="color:rgb(160,32,240);">then</span>
<span style="color:rgb(0,0,0);">fpathname</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(50,185,185);">strsplit</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">nams</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(50,185,185);">filesep</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span><span style="color:rgb(100,174,100);font-style:italic;"></span>
<span style="color:rgb(160,32,240);">else</span>
<span style="color:rgb(0,0,0);">fpathname</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(50,185,185);">strsplit</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">nams</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(50,185,185);">filesep</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span><span style="color:rgb(100,174,100);font-style:italic;"></span>
<span style="color:rgb(160,32,240);">end</span>
<span style="color:rgb(0,0,0);">scriptpath</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">get_absolute_file_path</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">fpathname</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(255,170,0);">$</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">chdir</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">scriptpath</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span></pre>
<br>
As you can see, I now check for the Scilab version, then pick the
proper part of the nams variable.<br>
<br>
/Claus<br>
<br>
On 08-09-2017 19:57, Claus Futtrup wrote:<br>
</div>
<blockquote type="cite"
cite="mid:fd6734cf-211e-8381-3382-15c541cff979@gmail.com">Hi all
<br>
<br>
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:
<br>
<br>
--> // ---- Change active directory to script directory ----
<br>
--> [units,typs,nams]=file(); // nams(1) = script file name
incl. path
<br>
--> fpathname=strsplit(nams(1), [filesep()]); // disp(b($-1));
<br>
--> scriptpath = get_absolute_file_path(fpathname($));
<br>
--> chdir(scriptpath);
<br>
Invalid buffer.
<br>
--> // ---- READ CONFIG FILE ----
<br>
<br>
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
<br>
<br>
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)
<br>
<br>
Thanks.
<br>
<br>
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.
<br>
<br>
/Claus
<br>
<br>
On 08-09-2017 19:47, Claus Futtrup wrote:
<br>
<blockquote type="cite">Hi all
<br>
<br>
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.
<br>
<br>
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: <a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/6.0.0/en_US/error_table.html">https://help.scilab.org/docs/6.0.0/en_US/error_table.html</a>
<br>
<br>
Best regards,
<br>
Claus
<br>
<br>
On 08-09-2017 16:48, Claus Futtrup wrote:
<br>
<blockquote type="cite">Hi Christophe
<br>
<br>
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.
<br>
<br>
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.
<br>
<br>
/Claus
<br>
<br>
On 08-09-2017 09:43, Dang Ngoc Chan, Christophe wrote:
<br>
<blockquote type="cite">Hello,
<br>
<br>
<blockquote type="cite">De : Pierre Vuillemin
<br>
Envoyé : jeudi 7 septembre 2017 22:20
<br>
<br>
Or you may want to comment suspicious parts of your code
until there is no more error....
<br>
</blockquote>
A very efficient way to isolate the error is to use
dichotomy.
<br>
<br>
Normally, the core of your script should consist in calling
functions.
<br>
So remove the first half of the functions and see if you get
the error.
<br>
If not, remove the other half.
<br>
You can then isolate in which half your function is.
<br>
Remove then the first half of the problematic half etc.
<br>
<br>
If both fail, then the problematic part is in the core
<br>
And you can isolate it in the same way.
<br>
<br>
Regards
<br>
<br>
-- <br>
Christophe Dang Ngoc Chan
<br>
Mechanical calculation engineer
<br>
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.
<br>
_______________________________________________
<br>
users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<p><br>
</p>
</body>
</html>