Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: dictionary update sequence element #2 has length 1; 2 is required #79

Open
AlainEspe opened this issue Dec 16, 2023 · 3 comments
Assignees

Comments

@AlainEspe
Copy link

Hello. I have this problem:
ValueError: dictionary update sequence element #2 has length 1; 2 is required

[INFO    ]: ======================== 
[INFO    ]: ======================== 
[INFO    ]: === Start amc2moodle === 
[INFO    ]: ======================== 
[INFO    ]: ======================== 
[INFO    ]: ====== Build XML ======= 
[INFO    ]:  > Search for magic comments... 
[INFO    ]:  > Running LaTeXML pre-processing (may take a while)... 
[INFO    ]:  > Running LaTeXML conversion 
[INFO    ]:  > Running Python conversion... 
Traceback (most recent call last):
  File "/home/alain/Applications/amc2moodle/./bin/amc2moodle", line 163, in <module>
    run()
  File "/home/alain/Applications/amc2moodle/./bin/amc2moodle", line 148, in run
    a2m.amc2moodle(fileInput=fileIn, fileOutput=fileOut,keepFlag=keepFlag, catname=catname,indentXML=indentFlag, usetempdir=tempDir,magic_flag=magic_flag, cleanXML=cleanXML,include_styles=include_styles)
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/amc2moodle_class.py", line 171, in __init__
    self.runBuilding()
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/amc2moodle_class.py", line 329, in runBuilding
    convert.to_moodle(
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/convert.py", line 1116, in to_moodle
    quiz.toMoodle(os.path.join(pathout, fileout))
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/convert.py", line 852, in toMoodle
    self._scoring()
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/convert.py", line 981, in _scoring
    amc_bm = scoring2dict(barm[0].text)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/convert.py", line 109, in scoring2dict
    scoring = dict(map(str.strip, item.split("=")) for item in text.split(","))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: dictionary update sequence element #2 has length 1; 2 is required

@nennigb
Copy link
Owner

nennigb commented Dec 17, 2023

Hi,

Without the input file it is hard to fix the problem although it seems related to scoring (bareme). Could you post a minimal example illustrating your problem ?

Benoit

@nennigb nennigb self-assigned this Dec 17, 2023
@AlainEspe
Copy link
Author

Ok. Without bareme no problem. I give an example with error:
\baremeDefautS{v=0,p=-0.5,e=-0.5,b=2,m=0}
\baremeDefautM{v=0,p=-0,0,e=-0.0,haut=2,m=0}

@nennigb
Copy link
Owner

nennigb commented Dec 19, 2023

Hi,
I think the problem is due to a mixing of comma , and dot . in the \baremeDefautM{v=0,p=-0,0,e=-0.0,haut=2,m=0}.
If you use

\baremeDefautM{v=0, p=-0.0, e=-0.0, haut=2, m=0}

everything should works fine. But haut is not used in the amc2moodle scoring strategy. Please feel free to open a new issue if you think it could be usefull to have more options during the scoring. Note that moodle is less flexible since the best grade is 100%.

To see the local/global scoring read at each modification in your tex file you can change the verbosity level:

amc2moodle -vv your_text_file ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants