Jump to content

error in python code


Reinoud

Recommended Posts

Hi,

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...