i have a custom sys.excepthook in my main.py:
def application_exception_hook(type_, value, tb):
lines = format_exception(type_, value, tb)
for line in lines:
print(line)
sys.excepthook = sys._excepthook
sys.exit(1)
sys._excepthook = sys.excepthook
sys.excepthook = application_exception_hook
In case of a unhandled exception the console output is:
Traceback (most recent call last):
Error in sys.excepthook:
Traceback (most recent call last):
Original exception was:
Traceback (most recent call last):
Replacing...
for line in lines:
print(line)
...with...
print(lines)
...gives me this output:
['Traceback (most recent call last):\n', ' File "D:\\...\\framework.py", line 144, in openNesting\n foo = 123 / 0\n', 'ZeroDivisionError: division by zero\n']Error in sys.excepthook:
Traceback (most recent call last):
Original exception was:
Traceback (most recent call last):
So, in both cases there is an "Error in sys.excepthook", while in the first case the error already appears before printing out all the interesting attributes. I would like to know what could cause "Error in sys.excepthook" and how I can get ONLY this output:
Traceback (most recent call last):
File "D:\\...\\framework.py", line 144, in openNesting
foo = 123 / 0
ZeroDivisionError: division by zero
I could not find any solved topic adressing this specific problem.
Solved: There was an error in a method that duplicates stdout and stderr messages to a QtTextEdit. After manually tracing it down everything now works as expected.
Related
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.
I attempted to execute gdal_array.SaveArray, while the error prompted as follows:
Traceback (most recent call last):
File "D:/Python34/Mycase/gdalarray_use.py", line 5, in
gdal_array.SaveArray(band1,"D:/PyGDAL_Case/dem_cjz.tif",format="GTiff")
File "D:\Python34\lib\site-packages\osgeo\gdal_array.py", line 240, in SaveArray
return driver.CreateCopy( filename, OpenArray(src_array,prototype) )
File "D:\Python34\lib\site-packages\osgeo\gdal.py", line 1478, in CreateCopy
return _gdal.Driver_CreateCopy(self, *args, **kwargs)
ValueError: Received a NULL pointer.
The issue seems to be related to _gdal.Driver_CreateCopy,right? And I don't konw what is the meaning of "Received a Null pointer".
What measures should I take to tackle this problem?
Mine is tensor flow v 1.0 and i am getting this error how resolve this error
Error:-
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named rnn_cell
Thanks
Pratik goyal
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.
I try to follow pandas documentation. Installed it on Ubuntu 10.4 but when run nose test got result 0 test
~$ nosetests pandas
----------------------------------------------------------------------
Ran 0 tests in 0.002s
OK
It seems everything is installed correctly, so don't know what to do with it or how to interpret (I am new to nose test).
Can you help me interpret the output or advise how I should run this test
thanks
I got the ran 0 tests message in every directory I tried until I tried this:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/tests$ sudo nosetests *
sudo was necessary to get rid of access errors on the first go round. Then I got these errors:
======================================================================
FAIL: test_cast_internals (pandas.tests.test_frame.TestDataFrame)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/tests/test_frame.py", line 9092, in test_cast_internals
assert_frame_equal(casted, expected)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/util/testing.py", line 250, in assert_frame_equal
assert(left.columns.names == right.columns.names)
AssertionError
======================================================================
FAIL: test_constructor_from_items (pandas.tests.test_frame.TestDataFrame)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/tests/test_frame.py", line 2765, in test_constructor_from_items
assert_frame_equal(recons, self.frame)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/util/testing.py", line 250, in assert_frame_equal
assert(left.columns.names == right.columns.names)
AssertionError
======================================================================
FAIL: test_constructor_more (pandas.tests.test_frame.TestDataFrame)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/tests/test_frame.py", line 2565, in test_constructor_more
tm.assert_frame_equal(dm, self.frame)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/util/testing.py", line 250, in assert_frame_equal
assert(left.columns.names == right.columns.names)
AssertionError
======================================================================
FAIL: test_constructor_orient (pandas.tests.test_frame.TestDataFrame)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/tests/test_frame.py", line 2713, in test_constructor_orient
assert_frame_equal(recons, expected)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/util/testing.py", line 249, in assert_frame_equal
assert(left.index.names == right.index.names)
AssertionError
======================================================================
FAIL: test_constructor_subclass_dict (pandas.tests.test_frame.TestDataFrame)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/tests/test_frame.py", line 2267, in test_constructor_subclass_dict
assert_frame_equal(self.frame.sort_index(), frame)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/util/testing.py", line 249, in assert_frame_equal
assert(left.index.names == right.index.names)
AssertionError
======================================================================
FAIL: test_getitem_fancy_2d (pandas.tests.test_frame.TestDataFrame)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/tests/test_frame.py", line 620, in test_getitem_fancy_2d
assert_frame_equal(ix[:, :2], f.reindex(columns=['A', 'B']))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/util/testing.py", line 250, in assert_frame_equal
assert(left.columns.names == right.columns.names)
AssertionError
======================================================================
FAIL: test_getitem_fancy_boolean (pandas.tests.test_frame.TestDataFrame)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/tests/test_frame.py", line 1106, in test_getitem_fancy_boolean
assert_frame_equal(result, expected)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/util/testing.py", line 250, in assert_frame_equal
assert(left.columns.names == right.columns.names)
AssertionError
======================================================================
FAIL: test_time_series_plot_color_with_empty_kwargs (pandas.tests.test_graphics.TestDataFrameGroupByPlots)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/tests/test_graphics.py", line 752, in test_time_series_plot_color_with_empty_kwargs
self.assert_(line_colors == ['b', 'g', 'r'])
AssertionError: False is not true
----------------------------------------------------------------------
Ran 3382 tests in 341.290s
FAILED (SKIP=46, failures=8)