Bug 1419160 - ImportError: cannot import name CookieProfile
Summary: ImportError: cannot import name CookieProfile
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: python-pyramid
Version: epel7
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Randy Barlow
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-03 18:11 UTC by Randy Barlow
Modified: 2017-02-20 01:50 UTC (History)
5 users (show)

Fixed In Version: python-pyramid-1.5.6-3.el7
Clone Of:
Environment:
Last Closed: 2017-02-20 01:50:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Randy Barlow 2017-02-03 18:11:49 UTC
Description of problem:
pyramid expects webob.cookies to have CookieProfile, but it doesn't.


Version-Release number of selected component (if applicable):
python-pyramid-1.5.6-2.el7.noarch


How reproducible:
Every time.


Steps to Reproduce:
1. $ python -c "from pyramid.authentication import AuthTktAuthenticationPolicy"


Actual results:
$ python -c "from pyramid.authentication import AuthTktAuthenticationPolicy"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/pyramid/authentication.py", line 13, in <module>
    from webob.cookies import CookieProfile
ImportError: cannot import name CookieProfile


Expected results:
Pyramid should not traceback when any of its modules are imported.


Additional info:
This is blocking Bodhi 2.4.0 from building in EL 7.

Comment 1 Randy Barlow 2017-02-03 18:51:18 UTC
It seems that EPEL 7 has python-webob-1.2, and python-webob1.4-1.4.1. The former seems to be what is getting imported by python-pyramid, and is too old. python-pyramid-1.5.6 requires webob >= 1.3.1[0].

I see that there's a commit on python-pyramid to coerce it to use a newer WebOb, but it seems to me that it might not be working properly[1].


[0] https://github.com/Pylons/pyramid/blob/1.5.6/setup.py#L42
[1] http://pkgs.fedoraproject.org/cgit/rpms/python-pyramid.git/commit/?h=epel7&id=029cdd580308f99be27c6717a3b3e2e63b27ab5d

Comment 2 Randy Barlow 2017-02-03 19:25:06 UTC
I am not familiar with this technique used in pyramid's setup.py, but I was able to add that same code to pyramid's main __init__.py to get it to work. I think that might be a viable solution to this problem.

Comment 3 Ralph Bean 2017-02-03 19:56:43 UTC
Yeah, that `__requires__ = [\"WebOb>=1.3.1\"]; import pkg_resources` trick is the ugly, but recommended way to employ forward-compat packages on EPEL7.

Historically, we usually put that line in our wsgi file: the first thing to run during app start up.

Comment 4 Randy Barlow 2017-02-03 20:01:21 UTC
Hey Ralph!

I stole your code and made an update to the spec file to do the same thing for the __init__.py:

http://pkgs.fedoraproject.org/cgit/rpms/python-pyramid.git/commit/?h=epel7&id=ad85d2f0be1a584c6cd772fd011a268d9b960564

When I try my import example at the beginning of this bug report, this seems to do the trick! I think this will get Bodhi building again. I noticed that Bodhi also has this trick employed in a few places (like the wsgi you mentioned, and in a few scripts).

Comment 5 Fedora Update System 2017-02-03 20:11:55 UTC
python-pyramid-1.5.6-3.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-8be4fca016

Comment 6 Fedora Update System 2017-02-05 05:50:16 UTC
python-pyramid-1.5.6-3.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-8be4fca016

Comment 7 Fedora Update System 2017-02-20 01:50:05 UTC
python-pyramid-1.5.6-3.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.