yamcs / yamcs-studio

Desktop TM/TC Client for Yamcs
https://docs.yamcs.org/yamcs-studio/
Eclipse Public License 2.0
27 stars 14 forks source link

FileUtil with python issues? #111

Closed nmaas87 closed 2 years ago

nmaas87 commented 3 years ago

Dear all,

I tried these both examples to a) open a saveFileDialog and b) write a short textfile to my D:\ drive, using Python in Yamcs Studio. But I only get "Error in script" in the console, without further informations. Any ideas? :)

Thanks!

from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ConsoleUtil
from org.csstudio.opibuilder.scriptUtil import FileUtil
targetFile = FileUtil.saveFileDialog(false)
ConsoleUtil.writeString(targetFile)
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ConsoleUtil
from org.csstudio.opibuilder.scriptUtil import FileUtil
text = "file content"
FileUtil.writeTextFile("D:\test.txt", false, text, false)
fqqb commented 2 years ago

Since v1.6.1, the cause of the error is shown. I ran your scripts and in both cases got the following output: Error in script : NameError: name 'false' is not defined

So just change false to False, and should be good.