FeedparserDict object doesn't have 'content' attribute - feedparser

I am trying to get familiar with the feedparser library, but I don't seem to be able to access the content attribute of entries in the feedparser object:
d = feedparser.parse('http://www.reddit.com/r/python/.rss')
post = d.entries[2]
post.content
the above code block gives me this error:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\feedparser.py", line 414, in __getattr__
return self.__getitem__(key)
File "C:\Python34\lib\site-packages\feedparser.py", line 375, in __getitem__
return dict.__getitem__(self, key)
KeyError: 'content'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#87>", line 1, in <module>
content = post.content[0].value
File "C:\Python34\lib\site-packages\feedparser.py", line 416, in __getattr__
raise AttributeError("object has no attribute '%s'" % key)
AttributeError: object has no attribute 'content'

Just do a print(post) and you will probably see that it doesn't have a content attribute.
RSS feeds do not guarantee that it will have one.

Related

icons missing in Odoo 14

in a brand new installation of Odoo 14 I have installed the "web-responsive" module (in the OCA "web" repository)
in the menu screen, a couple of icons are missing (as shown in the attached picture)
AND I am seeing these messages in the log
2022-12-06 10:06:39,035 4436 INFO sperim odoo.addons.base.models.ir_attachment: _read_file reading /home/me/deployment_sc/data_dir/filestore/sperim/c5/c54d3d5e2b1320083bf5378b7c195b0985fa04c1
Traceback (most recent call last):
File "/home/me/odoo/odoo/odoo/api.py", line 789, in get
field_cache = field_cache[record.env.cache_key(field)]
KeyError: (None,)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/me/odoo/odoo/odoo/fields.py", line 970, in __get__
value = env.cache.get(record, self)
File "/home/me/odoo/odoo/odoo/api.py", line 793, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'res.users(2,).image_128'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/me/odoo/odoo/odoo/api.py", line 789, in get
field_cache = field_cache[record.env.cache_key(field)]
KeyError: (None,)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/me/odoo/odoo/odoo/fields.py", line 970, in __get__
value = env.cache.get(record, self)
File "/home/me/odoo/odoo/odoo/api.py", line 793, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'res.partner(3,).image_128'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/me/odoo/odoo/odoo/api.py", line 789, in get
field_cache = field_cache[record.env.cache_key(field)]
KeyError: (None, None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/me/odoo/odoo/odoo/fields.py", line 970, in __get__
value = env.cache.get(record, self)
File "/home/me/odoo/odoo/odoo/api.py", line 793, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'ir.attachment(10,).datas'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/me/odoo/odoo/odoo/api.py", line 789, in get
field_cache = field_cache[record.env.cache_key(field)]
KeyError: (None,)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/me/odoo/odoo/odoo/fields.py", line 970, in __get__
value = env.cache.get(record, self)
File "/home/me/odoo/odoo/odoo/api.py", line 793, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'ir.attachment(10,).raw'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/me/odoo/odoo/odoo/addons/base/models/ir_attachment.py", line 105, in _file_read
with open(full_path, 'rb') as f:
FileNotFoundError: [Errno 2] File o directory non esistente: '/home/me/deployment_sc/data_dir/filestore/sperim/c5/c54d3d5e2b1320083bf5378b7c195b0985fa04c1'
So, I understand a file is being searched and not found
But I don't understand why
As far as I can tell, these files are supposed to be static resources of the web-responsive module or of some other module distributed with Odoo
Why aren't they found ?
Try upgrading all the modules with -u all from terminal
Or try upgrading your 'base' module.
If your database is restored from another file, try importing your file store as well.

Is there a way to fix AttributeError: module 'tensorflow._api.v2.io.gfile' has no attribute 'Open'

ERROR: test_create_center_net_model_mobilenet (main.ModelBuilderTF2Test)
ModelBuilderTF2Test.test_create_center_net_model_mobilenet
Test building a CenterNet model using bilinear interpolation.
Traceback (most recent call last):
File "Tensorflow\models\research\object_detection\builders\model_builder_tf2_test.py", line 499, in test_create_center_net_model_mobilenet
self.get_fake_label_map_file_path())
File "Tensorflow\models\research\object_detection\builders\model_builder_tf2_test.py", line 80, in get_fake_label_map_file_path
with tf.io.gfile.Open(keypoint_label_map_path, 'wb') as f:
AttributeError: module 'tensorflow._api.v2.io.gfile' has no attribute 'Open'

External ID not found

Odoo Server Error
Traceback (most recent call last):
File "/home/odoo/src/odoo/14.0/odoo/tools/cache.py", line 85, in lookup
r = d[key]
File "/home/odoo/src/odoo/14.0/odoo/tools/func.py", line 71, in wrapper
return func(self, *args, **kwargs)
File "/home/odoo/src/odoo/14.0/odoo/tools/lru.py", line 34, in getitem
a = self.d[obj]
KeyError: ('ir.model.data', <function IrModelData.xmlid_lookup at 0x7f5794273a60>, 'account.account_invoices_without_payment')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/14.0/addons/web/controllers/main.py", line 2121, in report_download
response = self.report_routes(reportname, docids=docids, converter=converter, context=context)
File "/home/odoo/src/odoo/14.0/odoo/http.py", line 532, in response_wrap
response = f(*args, **kw)
File "/home/odoo/src/odoo/14.0/addons/web/controllers/main.py", line 2056, in report_routes
pdf = report.with_context(context)._render_qweb_pdf(docids, data=data)[0]
File "/home/odoo/src/odoo/14.0/addons/account/models/ir_actions_report.py", line 41, in _render_qweb_pdf
invoice_reports = (self.env.ref('account.account_invoices_without_payment'), self.env.ref('account.account_invoices'))
File "/home/odoo/src/odoo/14.0/odoo/api.py", line 511, in ref
return self['ir.model.data'].xmlid_to_object(xml_id, raise_if_not_found=raise_if_not_found)
File "/home/odoo/src/odoo/14.0/odoo/addons/base/models/ir_model.py", line 1944, in xmlid_to_object
t = self.xmlid_to_res_model_res_id(xmlid, raise_if_not_found)
File "/home/odoo/src/odoo/14.0/odoo/addons/base/models/ir_model.py", line 1928, in xmlid_to_res_model_res_id
return self.xmlid_lookup(xmlid)[1:3]
File "", line 2, in xmlid_lookup
File "/home/odoo/src/odoo/14.0/odoo/tools/cache.py", line 90, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/odoo/src/odoo/14.0/odoo/addons/base/models/ir_model.py", line 1921, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system:
account.account_invoices_without_payment
The error occurs when I tried to print an invoice. It happens even if I choose an empty print template. Any help?Thanks.
In my opinion, you should be check table ir_model_data with name=account.account_invoices_without_payment. If you can find, you must update module account. If you can't find, you can be insert new record table ir_model_data with name and res_id = id view account_invoices_without_payment in ir_ui_view.
May be help you.
Please upgrade the module account and make sure that the db using correctly. You can give db-filter to choose the db correctly
After checking in the settings-> external id. I find that somehow this external id got deleted for unknown reason. I opened an new database and compared and find that this is the case then I create a new eternal id according to the new db's value.

use AWS_PROFILE in pandas.read_parquet

I'm testing this locally where I have a ~/.aws/config file.
~/.aws/config looks some thing like:
[profile a]
...
[profile b]
...
I also have a AWS_PROFILE environmental variable set as "a".
I would like to read a file in which is accessible with profile b using pandas.
I am able to access it through s3fs by doing:
import s3fs
fs = s3fs.S3FileSystem(profile="b")
fs.get("BUCKET/FILE.parquet", "FILE.parquet")
pd.read_parquet("FILE.parquet")
However, if I try to pass this to pd.read_parquet using storage_options I get a PermissionError: Forbidden.
pd.read_parquet(
"s3://BUCKET/FILE.parquet",
storage_options={"profile": "b"},
)
full Traceback below
Traceback (most recent call last):
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/s3fs/core.py", line 233, in _call_s3
out = await method(**additional_kwargs)
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/aiobotocore/client.py", line 154, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (403) when calling the HeadObject operation: Forbidden
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/pandas/io/parquet.py", line 459, in read_parquet
return impl.read(
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/pandas/io/parquet.py", line 221, in read
return self.api.parquet.read_table(
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/pyarrow/parquet.py", line 1672, in read_table
dataset = _ParquetDatasetV2(
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/pyarrow/parquet.py", line 1504, in __init__
if filesystem.get_file_info(path_or_paths).is_file:
File "pyarrow/_fs.pyx", line 438, in pyarrow._fs.FileSystem.get_file_info
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/_fs.pyx", line 1004, in pyarrow._fs._cb_get_file_info
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/pyarrow/fs.py", line 226, in get_file_info
info = self.fs.info(path)
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/fsspec/asyn.py", line 72, in wrapper
return sync(self.loop, func, *args, **kwargs)
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/fsspec/asyn.py", line 53, in sync
raise result[0]
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/fsspec/asyn.py", line 20, in _runner
result[0] = await coro
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/s3fs/core.py", line 911, in _info
out = await self._call_s3(
File "/home/ray/local/bin/anaconda3/envs/main/lib/python3.8/site-packages/s3fs/core.py", line 252, in _call_s3
raise translate_boto_error(err)
PermissionError: Forbidden
Note: there is an old question somewhat related to this but it didn't help: How to read parquet file from s3 using dask with specific AWS profile
You just need to add the following argument to the function:
storage_options=dict(profile='your_profile_name')
Hence the read statement is:
pd.read_parquet("s3://your_bucket",storage_options=dict(profile='your_profile_name'))

Odoo install app ,Error:AttributeError: 'NoneType' object has no attribute 'id'

Odoo Server Error:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 648, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 685, in dispatch
...............
return api.model(lambda model: field.convert_to_write(value(model)))
File "/usr/lib/python2.7/dist-packages/openerp/fields.py", line 1719, in convert_to_write
return value.id
AttributeError: 'NoneType' object has no attribute 'id'
I get this error everytime I install the system app. Why am I encountering it and how can I avoid it?