python can't use random function!

why the python script cant't use the random function。and how to import the py module? i suggest SS must have the function of python random.Tansks!

As of screen-scraper 5.0.7a

As of screen-scraper 5.0.7a the embedded python in screen-scraper is Jython 2.5.1, and you should be able to use any python module supported by Jython (including 'random' :)

You'll need to make sure the "Allow upgrading to unstable versions" box is checked in screen-scraper's settings dialog box, then select "Options" -> "Check for updates" from the menu to get the update.

~John

missing random module

Screenscraper uses an embedded version of Jython to execute python scripts. The "random" module is part of the standard library that ships with Jython, but Screen-scraper doesn't ship that library (currently).

As a work-around you can install jython and libraries separately (see http://jython.org/downloads.html), and add the library to the script's search path. For example, if you install Jython in C:\jython, put this in your script:


import sys
if "C:\\jython\\Lib" not in sys.path:
sys.path.append("C:\\jython\\Lib")
import random
...

See http://community.screen-scraper.com/scripting_in_python for more on the python search path and importing modules.

We will likely do an alpha release soon which includes the standard library, and you won't need the above work-around.

lisihong, Thank you for

lisihong,

Thank you for bringing this to our attention. We are looking into the matter and will let you know when we have a solution.

-Scott