ImSoErgodic / py-upset

A pure-python implementation of the UpSet suite of visualisation methods by Lex, Gehlenborg et al.
313 stars 57 forks source link

import pyupset as pyu #13

Open koustubhavachat opened 7 years ago

koustubhavachat commented 7 years ago

Getting SyntaxError: invalid syntax on import pyupset as pyu

Traceback (most recent call last): File "C:\MyWork\upset\upsetxmplgithub.py", line 1, in <module> import pyupset as pyu File "C:\Python27\lib\site-packages\pyupset\__init__.py", line 2, in <module> from .visualisation import plot File "C:\Python27\lib\site-packages\pyupset\visualisation.py", line 12 def plot(data_dict,*, unique_keys=None, sort_by='size', inters_size_bounds=(0, np.inf), ^ SyntaxError: invalid syntax

radlinsky commented 7 years ago

Hello, I am seeing this same error... screen shot 2017-06-20 at 11 40 22 am

samuelmiver commented 7 years ago

Same error here:

  File "/usr/local/lib/python2.7/dist-packages/pyupset/visualisation.py", line 12
  def plot(data_dict, *, unique_keys=None, sort_by='size', inters_size_bounds=(0, np.inf),
                     ^
   SyntaxError: invalid syntax
davidemms commented 6 years ago

Hi

I get the same error. Is there any fix or workaround?

Thanks! David

popher commented 6 years ago

Looks like it's a Python 2 issue related to having *args in the function before the remaining default arguments.

Two solutions: 1) Use python3. 2) Edit visualisation.py to fix this (move the to the end of the function brackets, and check that that doesn't break anything else). i.e. change: `def plot(data_dict, , unique_keys=None, sort_by='size', inters_size_bounds=(0, np.inf), inters_degree_bounds=(1, np.inf), additional_plots=None, query=None): to def plot(data_dict, unique_keys=None, sort_by='size', inters_size_bounds=(0, np.inf), inters_degree_bounds=(1, np.inf), additional_plots=None, query=None, *):` I don't use python 2 so I can't test it readily.

dhmay commented 6 years ago

The fix above works in Python 2.7, with two changes:

  1. The last argument should be "*args", not "*"
  2. there's more than one function in visualization.py that needs to change