Jump to content
Sign in to follow this  

error in python code

Recommended Posts


I try to use a python script what give stable solutions for the roommate problem. I have found this script: path to github.

I get it to run from php with 

$output1 = exec(. /stableroomate.py   ./solution_prefs.csv  2>&1", $output2)
var_dump ($output1);

But I get an error: string(27) "SyntaxError: invalid syntax" Array ( [0] => File ".stableroomate.py", line 170 [1] => holds = dict( (name, None) for name in prefs.keys() ) [2] => ^ [3] => SyntaxError: invalid syntax )

This refers to python (see attached stableroomate.py) 

# holds
    holds = dict( (name, None) for name in prefs.keys() )


What is wrong with this syntax? I tried to contact the author and  the university where this came from, but there is little response. I am not familiar with python.

Help here is greatly appreciated. 


README.md solution_prefs.csv stableroomate.py

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...