import error

19 views
Skip to first unread message

marrou...@gmail.com

unread,
Mar 10, 2018, 4:54:10 AM3/10/18
to Glowscript Users
hi,

I am a beginner with python.

I am trying to run a proposed program in the ANU's Astrophysics MOOC (Australian National University).
3 statements block execution at the beginning of the program with an error message.

Here they are :
from time import clock -> Error: Line 3: can not import from time
from random import - Error: Line 3: Can not import from random

How to solve this problem ?

Thank you for your help.

Marroux

Bruce Sherwood

unread,
Mar 10, 2018, 8:16:45 AM3/10/18
to Glowscript Users
Delete those two lines; GlowScript VPython provides clock(), random(), and arange() automatically. 

You mention 3 statements but only list 2...?

At glowscript.org it is not possible to import standard Python modules. Python programs are processed by the RapydScript-NG Python-to-JavaScript transpiler. If you need to access Python modules other than those provided at glowscript.org, you need to use VPython 7: see vpython.org.

Bruce

Bruce Sherwood

unread,
Mar 10, 2018, 8:27:35 AM3/10/18
to Glowscript Users
I should also comment that all the standard math functions are also supplied automatically.

Out of curiosity, can you provide a link to the MOOC? Thanks.

Bruce

marrou...@gmail.com

unread,
Mar 10, 2018, 9:52:14 AM3/10/18
to Glowscript Users
thank you for your reply
there were two errors related to random

marrou...@gmail.com

unread,
Mar 10, 2018, 9:56:24 AM3/10/18
to Glowscript Users
Reply all
Reply to author
Forward
0 new messages