Opened 3 years ago

Last modified 3 years ago

#27821 closed defect : Fix AttributeError — at Version 3

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(
    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 therefore it can not be used with a with ... as ... syntax.

Change History (3)

comment:1 Changed 3 years ago by vklein

  • Summary changed from : Fix AttributeError to : Fix AttributeError

comment:2 Changed 3 years ago by vklein

  • Description modified (diff)

comment:3 Changed 3 years ago by vklein

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