Opened 3 years ago

Last modified 3 years ago

#27821 closed defect

covering_design.py : Fix AttributeError — at Version 2

Reported by: vklein Owned by:
Priority: major Milestone: sage-8.8
Component: combinatorial designs Keywords: thursdaysbdx
Cc: slabbe, slelievre Merged in:
Authors: Vincent Klein Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by vklein)

Fix the following bug.

sage: C = designs.best_known_covering_design_from_LJCR(7, 3, 2)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-a3d9f9e592f1> in <module>()
----> 1 C = designs.best_known_covering_design_from_LJCR(Integer(7), Integer(3), Integer(2))

/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/combinat/designs/covering_design.pyc in best_known_covering_design_www(v, k, t, verbose)
    525     if verbose:
    526         print("Looking up the bounds at %s" % url)
--> 527     with urlopen(url) as f:
    528         s = bytes_to_str(f.read())
    529     if 'covering not in database' in s:  # not found

AttributeError: addinfourl instance has no attribute '__exit__'

Found by Sebastien Labbé see #26592

The root cause is that the object returned by urlopen doesn't have an __exit__ method in python2 and therefor it can not be used with a with ... as ... syntax.

Change History (2)

comment:1 Changed 3 years ago by vklein

  • Summary changed from convering_design.py : Fix AttributeError to covering_design.py : Fix AttributeError

comment:2 Changed 3 years ago by vklein

  • Description modified (diff)
Note: See TracTickets for help on using tickets.