Pi Gibberish trying to write to Desktop

I’m having trouble writing data to the Pi desktop, so I wrote a simple file to see what’s wrong.
Here is the complete code, in a file named RPText, in a pushbutton event, to write text to a Pi 3 desktop file. Any reason to expect this to not work?

Dim PiDocuments As FolderItem= SpecialFolder.Desktop
If PiDocuments <> Nil Then
Dim f As FolderItem = PiDocuments.Child(“test.txt”)
If f <> Nil Then
Dim t As TextOutputStream = TextOutputStream.Create(f)
t.writeline (“Test” )
End Try
End If
end if

The code works fine in Windows, but on executing the code on the Pi I get only the following when it starts. What is this indicating? It may have nothing to do with my code. I’ve seen a similar response before, but it went away and I don’t know why.

sudo ./RPtext
./RPtext: 1: ./RPtext: ?F@?78@@@@@@????@?@@@??????^?^XGxG??^?^: not found
./RPtext: 1: ./RPtext: cannot open
P?I???: No such file
./RPtext: 1: ./RPtext: Q?td??@?@: not found
./RPtext: 5: ./RPtext: ??J?
??NB+DY: not found
./RPtext: 2: ./RPtext: ?N?????
??GE2: not found
./RPtext: 4: ./RPtext: @?FTOa
?H?????: not found
./RPtext: 5: ./RPtext: K^?=: not found
./RPtext: 7: ./RPtext: ?=P?Xr??
0KT?: not found
./RPtext: 9: ./RPtext: ?VG^?
?JB): not found
./RPtext: 11: ./RPtext: @?Ugs?
?#?: not found
?#-H_q13: ./RPtext: @?IK??!
p?Kt?: not found
./RPtext: 15: ./RPtext: P?Oc?
J??: not found
./RPtext: 1: ./RPtext: ELF: not found
./RPtext: 24: ./RPtext: ?K^8
@?IKr: not found
./RPtext: 26: ./RPtext: ??N$?
0oJE?: not found
./RPtext: 29: ./RPtext: ??NQ?
:: not found
./RPtext: 8: ./RPtext: Syntax error: word unexpected (expecting “)”)

Might be Fonts - I recall having to tell the pi where the fonts are found.
Here are notes I made:
On Linux you need to make sure you have gtk/gdk libraries installed. Also please install some fonts and use CDBaseChartMBS.SetFontSearchPath to tell ChartDirector about your fonts folder. Without fonts, no text will show up.

Same with DnaPDF used in the Shorts reporting.


Install ttf-mscorefonts-installer
sudo apt-get install ttf-mscorefonts-installer

For ubuntu, you can install the ttf-mscorefonts-installer package and call this method with
“/usr/share/fonts/truetype/msttcorefonts” as the path.

fontconfig is the underlying configuration tool; you may find the following programs useful:

fc-list – lists fonts
fc-cache -fv – rebuilds cached list of fonts

HI David,

I ran your code and nothing appeared on my Raspberry Pi. It seems that the SpecialFolder.Desktop folderitem is being ignored or has an issue.

I created the following code which manually creates the native path name to the desktop and it works on my Raspberry Pi.

Sub Action() Handles Action Dim t As TextOutputStream Dim f As FolderItem 'f=SpecialFolder.Desktop.Child("TestService.txt") //Doesnt Work f = New FolderItem("/home/pi/Desktop/TestFile.txt") //This path works If f <> Nil Then t = TextOutputStream.Create(f) t.WriteLine("test") t.Close End If End Sub

I then ran the following code in a terminal where the executable was located:

sudo chmod +x RPText sudo ./RPText

Eugene, you solved my initial problem of not being able to write to a file on the Pi, but it looks like I may still have a fonts problem, as your version of my test still generates gibberish. But using your path to the Desktop, my much more complicated original program is writing the data I want to the desktop, so my problem is solved. The test version gibberish remains a mystery, but is no longer a problem for me. But I’ll provide details below if anyone is interested.

I had hoped Tim may have revealed why MBS Chartdirector won’t display any text on graphs in my original program, but still no luck there. Maybe this needs a new thread. I tried his suggestions:

cd /usr/share/fonts/truetype ’ had to add cd
Install ttf-mscorefonts-installer ’ Pi responds with bash: Install: command not found
sudo apt-get install ttf-mscorefonts-installer ’ does appear to install dozens of fonts
fc-list ’ lists dozens of fonts
fc-cache -fv 'lists multiple font families, and reports succeeded

Eugene’s code still generates gibberish, says ELF is not found. Google tells me ELF is Executable and Linkable Format, suggesting the Xojo compilation is the problem. So I went back to 2018 r1.1, and got different gibberish, but apparently ELF is not the problem this time. The first line was:

Xojo 2018 r2:
./RPtext: 1: ./RPtext: ?F@z#@8@@@@@@????@?@@@??^^pF?F^^: not found

Xojo 2018 r1.1:
./RPtext: 1: ./RPtext: ELF: not found
./RPtext: 4: ./RPtext: .IL?
??: not found
./RPtext: 2: ./RPtext:
?\Kd?: not found
./RPtext: 4: ./RPtext: ?+N?????
?G!9: not found
./RPtext: 10: ./RPtext: PB2K?FTVh
??G????: not found
./RPtext: 11: ./RPtext: Syntax error: “)” unexpected

Are you sure the app was compiled for Linux ARM?

@Greg O’Lone is probably correct, make sure the build target is ARM.
Your result looks like it’s trying to run as a shell script.

ELF is the correct binary format.
Try running

file ./RPText

You should see something like:

wipi: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.26, not stripped
If ‘file’ reports “Intel 80386” it is the wrong CPU target.

Greg was correct. I had compiled the test program for Linux, but it had been so long since I set up my main program I had forgotten the apparently redundant step of also setting the architecture.