Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Notice Board

Per partecipare al corso di Fondamenti di programmazione 2023-24 loggatevi e attivatelo nella vostra pagina dei corsi preferiti. A quel punto il corso appare nel menù personale cliccando sul proprio avatar. Per i materiali degli anni precedenti seguite lo stesso metodo.

To join the Programming/Lab 2023-24 course, log-on and select it on the my courses page. It will appear on the personal menu of your avatar. For earlier years use the same method.

Comando per eseguire 3 run da 5 test. Come fixare?

K
Khalester (3310 points)
2 5 24
in Es1 by (3.3k points)

Ciao a tutti, quando eseguo il comando:" python -u -m timeit -v -v -v -v -n 5  -r 3  -s 'from test_0X import Test' 'Test.main()' ". Mi dà questo errore:

Traceback (most recent call last):
  File "C:\Users\raide\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\raide\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\raide\Anaconda3\lib\timeit.py", line 362, in <module>
    sys.exit(main())
  File "C:\Users\raide\Anaconda3\lib\timeit.py", line 315, in main
    t = Timer(stmt, setup, timer)
  File "C:\Users\raide\Anaconda3\lib\timeit.py", line 111, in __init__
    compile(setup, dummy_src_name, "exec")
  File "<timeit-src>", line 1
    'from
        ^
SyntaxError: EOL while scanning string literal

Come mai?

326 views
closed

1 Answer

Best answer
a
alex_err (5800 points)
1 3 32
by (5.8k points)
selected by

Se sei in ambiente Windows  -s 'from test_0X import Test' viene interpretato male per via degli spazi che ci sono, riscrivilo come:  -s "'from test_0X import Test'" (ho aggiunto il doppio apice all'inizio e alla fine: ho " + 'from ... Test' + ").

Comando corretto per ambiente Windows: python -u -m timeit -v -v -v -v -n 5  -r 3  -s "'from test_0X import Test'" 'Test.main()'.