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
Hi Guys

I would like to use the function sharedvars. I've seen many examples of people using it like that:
With the imports:
import scalalib
import scala5
I can't install the Modules with pip so I searched in the Internet for them. I found absolutely nothing about scala5 but i found a github repository for scalalib:

I downloaded it but can't get it to work. If I put it in the site-packages folder from Python I can't import it and use it.

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.

Would be very appreciated.
Neither of those packages are in, therefore pip will not work.
You will have to resort to the github accounts and find installation instructions
scalalib can be found in many github repositories (take caution)
same for scala 5
pypi options:
(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.

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
λ git clone
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.

λ cd scala-tests\

E:\div_code\scala\scala-tests (master)
λ ls  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   test_scripts/
'create pydocs.bat'

# 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.

            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.
            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.

            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'>

Possibly Related Threads…
Thread Author Replies Views Last Post
  client.get_all_tickers() Doesn't work gerald 2 475 Jun-16-2022, 07:59 AM
Last Post: gerald
  pip doesn't work after Python upgrade Pavel_47 10 1,032 May-30-2022, 03:31 PM
Last Post: bowlofred
  For Loop Works Fine But Append For Pandas Doesn't Work knight2000 2 739 Dec-18-2021, 02:38 AM
Last Post: knight2000
  getting an import statement to work in my program barryjo 1 785 Dec-06-2021, 04:28 PM
Last Post: snippsat
  Class Method to Calculate Age Doesn't Work gdbengo 1 805 Oct-30-2021, 11:20 PM
Last Post: Yoriz
  Unable to import sklearn after installing any package ilango 0 729 Oct-25-2021, 07:03 AM
Last Post: ilango
  Process doesn't work but Thread work ! mr_byte31 4 1,153 Oct-18-2021, 06:29 PM
Last Post: mr_byte31
  Psycopg2 doesn't work with python2 MedianykEugene 3 1,932 Aug-10-2021, 07:00 AM
Last Post: ndc85430
  UART Serial Read & Write to MP3 Player Doesn't Work bill_z 15 3,177 Jul-17-2021, 04:19 PM
Last Post: bill_z
  string function doesn't work in script ClockPillow 3 1,473 Jul-13-2021, 02:47 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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