(Apr-17-2020, 12:03 PM)manu_brighter Wrote: Can anyone help me to get either scala5 or scalalib working, so I can use sharedvars. Like some kind of step by step guide on how to install those modules.Here is run,it's old so need to use Python 2.6 or 2.7.
Quote:InstallationI do this step and get import to work can call
Python 2.6.x is required Just clone the repo, all requirements are included (see below)
scalalib.sharedvars()
I do not do next step which is to run a server on 8080.
# Clone Repo E:\div_code\scala λ git clone https://github.com/artsalliancemedia/scala-tests.git Cloning into 'scala-tests'... remote: Enumerating objects: 173, done. Receiving objects: 64% (111/eused 0 (delta 0), pack-reused 173 Receiving objects: 100% (173/173), 203.70 KiB | 0 bytes/s, done. Resolving deltas: 100% (52/52), done. Checking connectivity... done. E:\div_code\scala λ cd scala-tests\ E:\div_code\scala\scala-tests (master) λ ls README.md scala_monitor.py scala_tools.py scalalib/ settings-template.json test_image.png webservices/ E:\div_code\scala\scala-tests (master) λ cd scalalib\ # Now in right folder E:\div_code\scala\scala-tests\scalalib (master) λ ls __init__.py libtest.sca scalalib.py scalaprov.py test_scripts/ win32_unicode_argv.py 'create pydocs.bat' sca_publisher.py scalalink.py scalatools.py uni_shlex.py # Running 2.7 and with pypython for easier discover,can just use python command are the same E:\div_code\scala\scala-tests\scalalib (master) λ py -2.7 -m ptpython >>> import scalalib >>> svars = scalalib.sharedvars() >>> print(sharedvars.__doc__) A class to wrap Scala shared variables (WSH Objects), so using .Value isn't necessary to set/access their values. Shared variables can be accessed as attributes of the resulting object. Argument: defaults - A dictionary of default values to return. Additional behavior: - If attempting to read a variable that doesn't exist, or wasn't shared, this returns a default (if given), otherwise None. - Will silently drop assignments to variables that weren't shared. - The Scala vars continue to be available in the main namespace. - This version fixes the bug regarding one-element arrays not returning to the Scala Script. Notes: Use of this object is optional and not required to access Scala's shared variables. However, its use makes it easier to write scripts that work at the command prompt as well, since scripts won't crash on variable access. Example: import scalalib svars = scalalib.sharedvars() # a defaults dict can be passed here. f = file(svars.filename) # get value svars.result = 15 # set value >>> type(svars) <type 'instance'>