-
Notifications
You must be signed in to change notification settings - Fork 7
LabRAD upgrade issue: labrad-migrate-registry doesn't work with string #96
Description
I am a user of the old Delphi LabRAD manager for years. Now I am trying to upgrade to the new scalabrad manager, but backward compatibility is of my highest priority. For newer users who never touched the Delphi version, these issues might not be interesting…
Since I have multiple problems, I will split them to different issues.
Test platform: Windows 7 x64, Java 8 up to date, Python 2.7, pylabrad up to date, without footprint of previous versions of LabRAD.
I have a lot of old registry files (*.key) generated by the old Delphi manager. When the key contains a string, one MUST use the double quotation marks, otherwise the Delphi manager won't accept it. Now it has become a problem.
For example, a file named test.key contains:
"this is a test"
The latest registry does not accept this string. I get:
reg.dir()
Out[152]: ([], ['new_test', 'test'])
reg.get('test')
Traceback (most recent call last):
File "", line 1, in
reg.get('test')
File "c:\python27\lib\site-packages\labrad\client.py", line 65, in call
return f.result() if wait else f
File "c:\python27\lib\site-packages\concurrent\futures_base.py", line 429, in result
return self.__get_result()
File "c:\python27\lib\site-packages\concurrent\futures_base.py", line 381, in __get_result
raise exception_type, self._exception, self._traceback
Error: (nonArrayData | array):1:1 ...""this is a"
I must replace the double quotation marks with single quotation marks, then it works:
reg.get('new_test')
Out[154]: 'this is a test'
Now, there is this labrad-migrate-registry tool that is supposed to migrate old registry into the latest format. So I gave it a try. But there are a few problems...
-
The migration does not go to the sub-directories, but only read the .key files in the specific directory. This is bad if I have a registry with hundreds of sub-directories. Is there a switch to let the program go through all the directories and convert all the .key files? I didn't find the switch in the --help.
-
When the migration meets a .key file that contains strings with old double quotation mark format such as "xxx", it still fails. For example, the string "VNA" with double quotation mark with trigger this error:
Exception in thread "main" java.lang.RuntimeException: (nonArrayData | array):1:1 ...""VNA"
at scala.sys.package$.error(package.scala:27)
at org.labrad.util.Parsing$.parseOrThrow(Parsing.scala:33)
at org.labrad.registry.DelphiParsers$.parseData(DelphiStore.scala:75)
at org.labrad.registry.DelphiFormat$.stringToData(DelphiStore.scala:182)
at org.labrad.registry.DelphiFileStore.decodeData(DelphiStore.scala:62)
at org.labrad.registry.FileStore.getValue(FileStore.scala:89)
at org.labrad.registry.FileStore.getValue(FileStore.scala:17)
at org.labrad.registry.Migrate$LocalRegistry$$anonfun$get$2.apply(Migrate.scala:222)
at org.labrad.registry.Migrate$LocalRegistry$$anonfun$get$2.apply(Migrate.scala:221)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:35)
at org.labrad.registry.Migrate$LocalRegistry.get(Migrate.scala:221)
at org.labrad.registry.Migrate$.org$labrad$registry$Migrate$$traverse$1(Migrate.scala:100)
at org.labrad.registry.Migrate$.main(Migrate.scala:118)
at org.labrad.registry.Migrate.main(Migrate.scala)
Basically the labrad-migrate-registry tool fails exactly where the new registry itself would fail. I guess it's because the labrad-migrate-registry tool was not designed to migrate stone-age registry files like mine, but only can convert middle-age files? :)
Anyway, I am reporting it (as a bug?) and hopefully there is an easy fix available.