View Single Post
Old 06-23-2021, 12:17 AM   #5
jpwhiting
Junior Member
jpwhiting began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jun 2014
Device: Android phone
Thanks for your help, but I'm still not following. action.py's PlayUploadAction class doesn't have any actual_plugin in it. Adding one with the same string value as __init__.py didn't seem to help either. It seems like the "with" keyword doesn't know what to do with a string (self.actual_plugin is defined as a string with value 'calibre_plugins.play_books_upload.action:PlayUplo adAction') or am I missing something?

Here's what I get with the force push I did to my implementation branch now:

Traceback (most recent call last):
File "calibre_plugins.play_books_upload.action", line 112, in upload_books
AttributeError: __enter__

from reading this:

The with statement is a control-flow structure whose basic structure is:

with expression [as variable]:
with-block

The expression is evaluated, and it should result in an object that supports the context management protocol (that is, has __enter__() and __exit__() methods).

I think self.actual_plugin which is just a string doesn't have that __enter__() or __exit__() method like a file for example would.
jpwhiting is offline   Reply With Quote