Scilab issue with exec command - scilab

I am using Scinote 5.4.0 with OSX 10.7.4. I am unable to execute script files from the console using the exec("path") command; when I do so, only the first line of the script file is read.
Example:
-->exec("plot1.sce")
-->x=[0:.1:10]'; //(the first line of my code)
If however I "execute with echo" from the editor Scinote, the script will run just fine.
Does anybody know what is going on? (The script files I am trying to run are in my present working directory).
Thanks!
Update: I just installed Scilab on an identical machine and the same thing is happening.
Update: Per Scilab's bugtracker, it appears to be caused by Scinote defaulting to cr eol on a mac. I don't really know what this means or how to fix it, but the adventure continues!
Update: I found the solution!:http://comments.gmane.org/gmane.comp.mathematics.scilab.user/6184
In the preferences, I changed the eol to Unix, and the default file encoding to iso-8859-1. I restarted and exec is now working!

The link is not easy to follow so here's the answer (pasted)
The problem is actually scinote's, not scilab's. I don't have a Lion
machine to check if I'm correct, but it seems scinote's file encoding
is no longer compatible in ML. I discovered that when I opened scinote
generated files with a different text editor (vi) the new lines
weren't encoded right for my machine. The other give-away was that
executing scripts written prior to upgrading worked fine.
Go to preferences and in the scinotes tab, switch default file
encoding to iso-8859-1. I also switched the end-of-line to Unix.

Related

I am trying to convert a python .PY file to .EXE. But the EXE file won't run because of "Fatal Error Detected Failed To Execute Script Error" Help Pls

I am a absolute beginner with Python. What I have done so far is I have installed Python with IDLE, Pycharm, Pygame-zero and Pyinstaller too. I have a (.py) file game I would like to turn into a (.exe) file. So I can release my game for my friends to play.
I have entered this command into CMD window "pyinstaller --onefile -w gamename.py"* (*My game is not really called "gamename". I have called it that in this code above. For this example only.)
When in the file folder of my game and then Pyinstaller converts my file into the (.exe) file. But everytime I try to run this file. It fails with this error message - "Fatal Error Detected, Failed To Execute Script Error".
I have watched all kinds of YouTube videos trying to solve this problem and have tried these following fixes:
Updated Pyinstaller (4.3).
Updated Python (3.9.5).
Changed the path in Enviroment Variables to point to Python39\Scripts and resetting my computer.
Coverted the (.py) file to (.exe) by including the console window. Then after running the program after when the console window disappears. Opening the CMD window again and typing the file directly "gamename.exe" to run.
Installing auto-py-to-exe program.
Each time deleting the Main, Dis and Spec files and moving the (.exe) file into the main file folder. With the resources for the games. Music, Images and Sounds.
Testing out my Python script to check. If it doesn't have any errors while loading through IDLE and it doesn't. It works straight away, I can play my game through IDLE. There is no errors in the code of my game script.
And after trying all of these solutions it still hasn't solved this issue.I still have the same error message appearing when trying to run my game. Now I have found out what the meaning is to this error message that appears. Which is:
"Fatal Error: failed to execute
This means something has gone wrong as it's giving you a visual warning about it; this is not an error, it's a warning; the real error has been printed to stdout/stderr. If you open the executable using the terminal or something else that will preserve the console output, you will most likely see a Python error telling you what went wrong. Fixing this and repackaging is the solution to this issue".
I have remade the (.exe) file including the console window and it does explan what the error is. When I try to run my game, the error comes up as:
"FileNotFoundError: {Errno 2} No such file or directory: C:*****\Local\Temp_MEI58602\pgzero\data\icon.png {4268} Failed to execute script.
Any suggestions? On how to fix this error please. So I can run and play my game outside of Python on any PC.
A Possible Answer:
I have found a webpage that has the possible answer to my problem. But I don't know what they mean, because I am a beginner with Python. Can anybody read this and break it down for me? Here is what it say's:
"Pyinstaller packaging exe, missing icons and other issues
Reason
When the exe runs, it will decompress a resource folder named "_MEI*" to a temporary directory on the computer, and delete it when the program ends.
uses a path like ‘\icon.png’ in the program. When the exe is running, it will only search for its own directory, of course it cannot be found.
Two, the solution
Make sure the picture is in this temporary resource folder
This can be done by editing the'.spec' configuration file to add pictures.
(Note: .spec is the file generated by Pyinstaller last time, in your python project directory.)
These are the three pictures I used, which is actually adding three tuples to the "binaries" list
Before the comma is the address of the picture in the python project, after the comma is the address of the package into the ‘_MEI*’ temporary folder.
I have built an ‘img’ folder to store pictures in it. Just put a dot in the root directory, such as (’./img/info.png’,’.’)
Finally, run when packagingpyinstaller program entry.spec, You can add the picture resource.
(Note: Other external resources can also be added in this way, such as .ini, .txt, .exe, etc.)
Make sure the program can find this path
Because the name of the temporary directory is different each time, a method is needed to dynamically obtain this path.
The code is presented, and the core statement is ‘os.path.realpath(sys.path[0])’.
Python running effect is as follows:
Package it as an exe, drag it to the cmd window and run it."
Here is the link to the webpage to the article. Because it makes use of screenshots that I can't include on this webpage;
(https://www.programmersought.com/article/94965073850/)
Please read this acticle and break it down for me. It does seem to be explaining the solution to my problem. But what does it all mean? What pictures is he talking about? Please explain.
I am not sure why but PyInstaller doesn't seem to bundle everything needed for Pygame Zero, including that icon.png file. The solution is simple, though. You just need to use pyinstaller --collect-all pgzero --onefile -w <scipt_name>. If your game has sounds, images or anything like that, remember to include those specific folders as well using --add-data <file_or_folder>. Also, make sure your script includes the following lines.
import pgzrun
# GAME CODE HERE
pgzrun.go()
I hope it helps, even though it is a little late.

Can't find a way to get graphic tablet drivers working on mint

So i was trying to install the XP Pen Driver for my Deco 01 v2 graphics tablet on my Linux Mint 19.2 Tina when i came to encounter the following error:
./Pentablet_Driver: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.10' not found (required by ./Pentablet_Driver)
I went on to install qt 5.10, still the same error. Others suggested to just change the path wth sudo gedit /etc/ld.so.conf.d/randomLibs.conf which didn't change a thing.
Link to drivers:
https://www.xp-pen.com/download-440.html
The manufacturer has a page describing how to set up their software on Linux with pictures. However, when following them, you end up with a folder name somewhere along the line that has spaces in it, which causes issues.
So a modified set of instructions might look like this:
Connect your XP-Pen product to the computer.
Download the Linux Beta driver from XP-Pen official website.
When the download is complete, extract the compressed folder.
Rename the extracted folder to something without spaces.
Inside the renamed folder is another compressed folder which should be extracted.
Inside the final extracted folder, ensure "Pentablet_Driver.sh" has execution permissions by right clicking on it and going to "Properties->Permissions" and verifying that "Allow executing file as program" is checked.
Open the terminal. (CTRL+ALT+T)
Type "sudo ", then drag Pentablet_Driver.sh from the file browser onto the terminal.
Type the password to complete.
Make sure that you write exactly
sudo ./Pentablet_Driver.sh
instead
sudo ./Pentablet_Driver
I had the same error until I noticed that I forgot to add .sh at the end.

cmd from R with wkhtmltopdf

I am trying to use wkhtmltopdf to turn website content into pdf and then read it into my R. So I write in my COMMAND PROMPT line to download as html front page of yahoo finance (just for fun). So i create "TemporaryFolder" on my C and write in cmd:
C:\Program Files\wkhtmltopdf\bin>wkhtmltopdf https://finance.yahoo.com/ "C:/TemporaryFolder/myhtml.pdf"
And it downloads yahoo finance website as pdf. Now I want to do the same thing but using R script. I know there is system function however I have very little experience with it (and with cmd to be honest).
So now i try use this command in my Rstudio so I can later create R script which downloads website as html and converts it to pdf.
URL="https://finance.yahoo.com/"
wkhtmltopdf_dir="C:/Program Files/wkhtmltopdf/bin"
save_as="C:/TemporaryFolder/myhtml.pdf"
x=paste0(wkhtmltopdf_dir,">","wkhtmltopdf"," ",URL," ",'\"',save_as,'\"')
system(x)
I also tried shell(x) but I got "permission denied".
But it does nothing... Could someone elaborate how system works and what should be added here?
BTW: can I harm my computer by using system? For example writing some "bad" command? This question might sound silly, but I am really to new to this.
What you're trying to paste as a command ("C:/Program Files/wkhtmltopdf/bin>wkhtmltopdf https://finance.yahoo.com/ \"C:/TemporaryFolder/myhtml.pdf\"") doesn't quite work. The first part ("C:/Program Files/wkhtmltopdf/bin>) is actually the prompt when you run it in commander. It's not a part of the command, but instead shows in which directory you are running that command.
If you replace wkhtmltopdf with C:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe, it should work just fine:
URL="https://finance.yahoo.com/"
wkhtmltopdf_exe="C:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe"
save_as="C:/TemporaryFolder/myhtml.pdf"
x=paste0(wkhtmltopdf_exe," ",URL," ",'\"',save_as,'\"')
system(x)
To answer your second question, a call to system() runs the command through CMD. So basically anything you could mess up through CMD.exe, you can mess up through system().
I figured out what was wrong. As i posted in comment, after using shell(x) instead of system(x) it returned 'C:/Program' is not recognized as an internal or external command, operable program or batch file.. So I reinstalled my wkhtmltopdf to folder which name contains no spaces. So wkhtmltopdf_exe is now:
wkhtmltopdf_exe="C:/Programs/wkhtmltopdf/bin/wkhtmltopdf.exe"
Rest of the code is the same. Followup here would be nice, is there any way to workaround spaces in folder names? Or should I always avoid spaces? Putting wkhtmltopdf path into quotation marks didnt help.
Thank for user JAD for fixing my first code

Where does RStudio store the temporary R script files before saved?

I've just had RStudio crash on me unexpectedly, and on re-starting, contrary to what I've come to expect, the R script I had been tinkering around with was nowhere to be found.
I've managed to track down the Rhistory file so I'll be able to piece together all the commands, which is reassuring.
However, I am curious if there's somewhere I might try looking to find the temporary unsaved file on the off chance that might be cached somewhere (after all, it is usually cached somewhere that RStudio apparently knows to look). Is there a particular file extension/format I should be searching for?
Currently running R 3.3.1 through RStudio 0.99.903 on Linux Mint 17.3 (over Ubuntu 14.04.3 LTS).
I've tried running grep on the command line to find some of the more recently updated lines of code; I may be out of luck. I found two files:
~/.rstudio-desktop/history_database
Which appears to basically be a more centralized .Rhistory for RStudio
and
~/.rstudio-desktop/sdb/s-9CD2C698/D7986B2A
This looks JSON-like and also appears to basically be an Rhistory. Please correct me if I'm wrong.
As indicated by #KevinUshey from RStudio:
RStudio stores autosave data as part of the JSON 'blobs' within the sdb folder. You should see the document serialized as a long 'string', with newlines embedded.
Use packages such as jsonlite to parse this and best of luck.
if you used Rstudio on linux, the temporary R script files were stored in .rstudio/sources folder, and you can open all of the script files directly.
Good luck
In Rstudio if you saved or not a script but you ran this code, you can check the history off the app, this is the "telemetric data" that Rstudio has about you.
In windows, this is the path,
C:\Users\ANALISTA\AppData\Local\RStudio\history_database
you should use "visual studio code" or something similar to see it.

Need help with gdbtui - gnu debugger on linux

I ssh into a remote linux sever from my Mac, and run gdbtui to debug a program. The source code displays, but the cursor line in the source code window frequently is not highlighted. I can enter commands such as 'next' and 'list' in the command line window, but the source code window doesn't redraw correctly. It sometimes shows lines in the source file out of order (the line numbers are displayed out of order.)
I have my TERM environment variable set to xterm-16color which vim is very happy to use. I'm at a loss as to what I should try.
gdb in ordinary command-line mode works fine.
Ideas?
What gdb version are you using? Try the latest one. At least gdb 6.5 had similar problems with tui mode.
I have the exact same configuration as you: I ssh into an Ubuntu server (currently 11.10) from a Mac and I'm currently experimenting with gdbtui.
I recommend that you use iterm2 as your Apple Terminal replacement. Besides 256 colors and a ton of other features, it seems to play decently with gdbtui (line highlighting is fine).

Resources