Python Forum
import scalalib package doesn't work
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
import scalalib package doesn't work
#3
(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:Installation

Python 2.6.x is required Just clone the repo, all requirements are included (see below)
I do this step and get import to work can call 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'>
Reply


Messages In This Thread
RE: import scalalib package doesn't work - by snippsat - Apr-17-2020, 06:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why doesn't calling a parent constructor work with arbitrary keyword arguments? PurposefulCoder 4 937 Jun-24-2023, 02:14 PM
Last Post: deanhystad
  Why doesn't this code work? What is wrong with path? Melcu54 7 1,785 Jan-29-2023, 06:24 PM
Last Post: Melcu54
  color code doesn't work harryvl 1 889 Dec-29-2022, 08:59 PM
Last Post: deanhystad
  client.get_all_tickers() Doesn't work gerald 2 1,714 Jun-16-2022, 07:59 AM
Last Post: gerald
  pip doesn't work after Python upgrade Pavel_47 10 4,200 May-30-2022, 03:31 PM
Last Post: bowlofred
  For Loop Works Fine But Append For Pandas Doesn't Work knight2000 2 2,013 Dec-18-2021, 02:38 AM
Last Post: knight2000
  getting an import statement to work in my program barryjo 1 1,662 Dec-06-2021, 04:28 PM
Last Post: snippsat
  Class Method to Calculate Age Doesn't Work gdbengo 1 1,703 Oct-30-2021, 11:20 PM
Last Post: Yoriz
  Unable to import sklearn after installing any package ilango 0 1,186 Oct-25-2021, 07:03 AM
Last Post: ilango
  Process doesn't work but Thread work ! mr_byte31 4 2,617 Oct-18-2021, 06:29 PM
Last Post: mr_byte31

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020