pyramid

`UnencryptedCookieSessionFactoryConfig` error when importing Apex

`UnencryptedCookieSessionFactoryConfig` error when importing Apex Question: I’m trying to use Apex and whenever I try to import it (or anything involving it) I get the following traceback: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/user/anaconda3/lib/python3.8/site-packages/apex/__init__.py", line 13, in <module> from pyramid.session import UnencryptedCookieSessionFactoryConfig ImportError: cannot import name ‘UnencryptedCookieSessionFactoryConfig’ from ‘pyramid.session’ …

Total answers: 6

How to find the cause of "task queue depth" warnings from waitress?

How to find the cause of "task queue depth" warnings from waitress? Question: Is there a recommended way to diagnose the cause of task queue depth warnings like the one below from waitress? Perhaps there is some way to log queued tasks / requests? 2019-04-25 14:45:23,048 WARNI [waitress.queue:122][MainThread] Task queue depth is 2 I am …

Total answers: 4

Pyramid Framework : Stream Camera using Opencv

Pyramid Framework : Stream Camera using Opencv Question: I have been trying to stream my webcam using the pyramid framework. The thing is the object generated is a generator object, and when I’m passing it over views, I do get the video stream at route (/video_feed) but it lags a lot. anyone? here’s the block …

Total answers: 1

sqlalchemy existing database query

sqlalchemy existing database query Question: I am using SQLAlchemy as ORM for a python project. I have created few models/schema and it is working fine. Now I need to query a existing MySQL database, no insert/update just the select statement. How can I create a wrapper around the tables of this existing database? I have …

Total answers: 5

SQLAlchemy – condition on join fails with AttributeError: Neither 'BinaryExpression' object nor 'Comparator' object has an attribute 'selectable'

SQLAlchemy – condition on join fails with AttributeError: Neither 'BinaryExpression' object nor 'Comparator' object has an attribute 'selectable' Question: I’m running SQLAlchemy with Pyramid. I’m trying to run a query with a custom ‘join’ condition : DBSession.query(A) .outerjoin(A.b, B.a_id == A.id) .all() however the query fails the following error : AttributeError: Neither ‘BinaryExpression’ object nor …

Total answers: 4

SQLAlchemy-Continuum and Pyramid: UnboundExecutionError

SQLAlchemy-Continuum and Pyramid: UnboundExecutionError Question: I have a Pyramid application that does CRUD with SQLAlchemy via pyramid_basemodel. All seems to work nicely. I then pip installed SQLAlchemy-Continuum, to provide history for certain objects. All I did to configure it was make the following alterations to my models.py file: import sqlalchemy as sa from sqlalchemy import …

Total answers: 2

ArgumentError: relationship expects a class or mapper argument

ArgumentError: relationship expects a class or mapper argument Question: I am getting this strange error, and I’m saying strange because I made a change to an unrelated table. I am trying to query my tDevice table which looks like this: class TDevice(Base): __tablename__ = ‘tDevice’ ixDevice = Column(Integer, primary_key=True) ixDeviceType = Column(Integer, ForeignKey(‘tDeviceType.ixDeviceType’), nullable=False) ixSubStation …

Total answers: 1

get table columns from sqlAlchemy table model

get table columns from sqlAlchemy table model Question: I have a table where I would like to fetch all the column names however after browsing the interwebs I could not find a way that works. This is what my table looks like: class myTable(Base): __tablename__ = ‘myTable’ col1 = Column(Integer, primary_key=True) col2 = Column(Unicode(10)) col3 …

Total answers: 5

Route requests based on the Accept header in Python web frameworks

Route requests based on the Accept header in Python web frameworks Question: I have some experience with different web frameworks (Django, web.py, Pyramid and CherryPy), and I’m wondering in which one will it be easier and hopefully cleaner to implement a route dispatcher to a different “view/handler” based on the “Accept” header and the HTTP …

Total answers: 3

SQLAlchemy boolean value is None

SQLAlchemy boolean value is None Question: I have this table in my Pyramid app class User(Base): __tablename__ = ‘users’ id = Column(Integer, primary_key=True) ….. is_active = Column(Boolean, unique=False) def __init__(self, name, raw_password): is_active = True When I did my test, it said is_active is None. def test_register_user(self): user = User(‘user1’, ‘1234’) self.sess.add(user) self.sess.flush() #print user …

Total answers: 5