Re: [jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
Many thanks Andi :) > On 17 Oct 2019, at 20:11 , Andi Vajda wrote: > > > Added __module__ to JArray() types in rev 1868563. > > On Thu, 17 Oct 2019, Petrus Hyvönen (Jira) wrote: > >> >> [ >> https://issues.apache.org/jira/browse/PYLUCENE-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16953958#comment-16953958 >> ] >> >> Petrus Hyvönen commented on PYLUCENE-51: >> >> >> Many Thanks for looking into this, most classes seems to have this property >> now but the JArray_* seems to use some other mechanism and do not have this? >> >>> "AttributeError: __module__" when running doctest >>> - >>> >>>Key: PYLUCENE-51 >>>URL: https://issues.apache.org/jira/browse/PYLUCENE-51 >>>Project: PyLucene >>> Issue Type: Bug >>>Environment: Ubuntu 19.04, Python 3.7 >>> Reporter: Clément Jonglez >>> Priority: Major >>> >>> Dear all, >>> I am using the Orekit Python wrapper by [~petrush] . I am running into >>> errors & warnings when trying to run tests with doctest. When collecting >>> tests, it analyzes the classes (all the 1000+ wrapped Java classes it >>> seems) and runs into the following error: >>> {noformat} >>> [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in >>> collect >>> for test in finder.find(module): >>> [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in find >>> extraglobs) >>> [...]/lib/python3.7/doctest.py:932: in find >>> self._find(tests, obj, name, module, source_lines, globs, {}) >>> [...]/lib/python3.7/doctest.py:993: in _find >>> self._from_module(module, val)): >>> [...]/lib/python3.7/doctest.py:960: in _from_module >>> return module._name_ == object._module_ >>> E AttributeError: _module_{noformat} > ??> In doctest > ([https://github.com/python/cpython/blob/master/Lib/doctest.py#L959]), the >>> {code:java} >>> inspect.isclass(object) {code} >>> condition at line 959 returns `True`, and therefore doctest tries to access >>> the object's __module__ attribute, which does not seem to exist. >>> Besides, pytest prints a warning for each Java class being wrapped, also >>> because they have no __module__ attribute (this is one example of 1000+ >>> warnings): >>> {noformat} >>> [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: builtin >>> type ExtendedKalmanFilter has no __module_ attribute >>> return f(*args, **kwds){noformat} >>> This phenomenon is new because 6 months ago I could run pytest & doctest >>> successfully with Orekit. I could not find which module contains the change >>> that broke stuff since then though. >>> To reproduce the phenomenon, you can check out >>> [https://github.com/GorgiAstro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/test_propagation.py#L164] >>> I was trying to validate some poliastro features using the Orekit python >>> wrapper. So this code requires poliastro, it is available on conda-forge. >>> Cheers >>> Clément >> >> >> >> -- >> This message was sent by Atlassian Jira >> (v8.3.4#803005)
Re: [jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
Added __module__ to JArray() types in rev 1868563. On Thu, 17 Oct 2019, Petrus Hyvönen (Jira) wrote: [ https://issues.apache.org/jira/browse/PYLUCENE-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16953958#comment-16953958 ] Petrus Hyvönen commented on PYLUCENE-51: Many Thanks for looking into this, most classes seems to have this property now but the JArray_* seems to use some other mechanism and do not have this? "AttributeError: __module__" when running doctest - Key: PYLUCENE-51 URL: https://issues.apache.org/jira/browse/PYLUCENE-51 Project: PyLucene Issue Type: Bug Environment: Ubuntu 19.04, Python 3.7 Reporter: Clément Jonglez Priority: Major Dear all, I am using the Orekit Python wrapper by [~petrush] . I am running into errors & warnings when trying to run tests with doctest. When collecting tests, it analyzes the classes (all the 1000+ wrapped Java classes it seems) and runs into the following error: {noformat} [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in collect for test in finder.find(module): [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in find extraglobs) [...]/lib/python3.7/doctest.py:932: in find self._find(tests, obj, name, module, source_lines, globs, {}) [...]/lib/python3.7/doctest.py:993: in _find self._from_module(module, val)): [...]/lib/python3.7/doctest.py:960: in _from_module return module._name_ == object._module_ E AttributeError: _module_{noformat} ??> In doctest ([https://github.com/python/cpython/blob/master/Lib/doctest.py#L959]), the {code:java} inspect.isclass(object) {code} condition at line 959 returns `True`, and therefore doctest tries to access the object's __module__ attribute, which does not seem to exist. Besides, pytest prints a warning for each Java class being wrapped, also because they have no __module__ attribute (this is one example of 1000+ warnings): {noformat} [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: builtin type ExtendedKalmanFilter has no __module_ attribute return f(*args, **kwds){noformat} This phenomenon is new because 6 months ago I could run pytest & doctest successfully with Orekit. I could not find which module contains the change that broke stuff since then though. To reproduce the phenomenon, you can check out [https://github.com/GorgiAstro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/test_propagation.py#L164] I was trying to validate some poliastro features using the Orekit python wrapper. So this code requires poliastro, it is available on conda-forge. Cheers Clément -- This message was sent by Atlassian Jira (v8.3.4#803005)
Re: [jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
Ah yes, I forgot about JArray. One sec. On Thu, 17 Oct 2019, Petrus Hyvönen (Jira) wrote: [ https://issues.apache.org/jira/browse/PYLUCENE-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16953958#comment-16953958 ] Petrus Hyvönen commented on PYLUCENE-51: Many Thanks for looking into this, most classes seems to have this property now but the JArray_* seems to use some other mechanism and do not have this? "AttributeError: __module__" when running doctest - Key: PYLUCENE-51 URL: https://issues.apache.org/jira/browse/PYLUCENE-51 Project: PyLucene Issue Type: Bug Environment: Ubuntu 19.04, Python 3.7 Reporter: Clément Jonglez Priority: Major Dear all, I am using the Orekit Python wrapper by [~petrush] . I am running into errors & warnings when trying to run tests with doctest. When collecting tests, it analyzes the classes (all the 1000+ wrapped Java classes it seems) and runs into the following error: {noformat} [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in collect for test in finder.find(module): [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in find extraglobs) [...]/lib/python3.7/doctest.py:932: in find self._find(tests, obj, name, module, source_lines, globs, {}) [...]/lib/python3.7/doctest.py:993: in _find self._from_module(module, val)): [...]/lib/python3.7/doctest.py:960: in _from_module return module._name_ == object._module_ E AttributeError: _module_{noformat} ??> In doctest ([https://github.com/python/cpython/blob/master/Lib/doctest.py#L959]), the {code:java} inspect.isclass(object) {code} condition at line 959 returns `True`, and therefore doctest tries to access the object's __module__ attribute, which does not seem to exist. Besides, pytest prints a warning for each Java class being wrapped, also because they have no __module__ attribute (this is one example of 1000+ warnings): {noformat} [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: builtin type ExtendedKalmanFilter has no __module_ attribute return f(*args, **kwds){noformat} This phenomenon is new because 6 months ago I could run pytest & doctest successfully with Orekit. I could not find which module contains the change that broke stuff since then though. To reproduce the phenomenon, you can check out [https://github.com/GorgiAstro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/test_propagation.py#L164] I was trying to validate some poliastro features using the Orekit python wrapper. So this code requires poliastro, it is available on conda-forge. Cheers Clément -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
[ https://issues.apache.org/jira/browse/PYLUCENE-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16953958#comment-16953958 ] Petrus Hyvönen commented on PYLUCENE-51: Many Thanks for looking into this, most classes seems to have this property now but the JArray_* seems to use some other mechanism and do not have this? > "AttributeError: __module__" when running doctest > - > > Key: PYLUCENE-51 > URL: https://issues.apache.org/jira/browse/PYLUCENE-51 > Project: PyLucene > Issue Type: Bug > Environment: Ubuntu 19.04, Python 3.7 >Reporter: Clément Jonglez >Priority: Major > > Dear all, > I am using the Orekit Python wrapper by [~petrush] . I am running into errors > & warnings when trying to run tests with doctest. When collecting tests, it > analyzes the classes (all the 1000+ wrapped Java classes it seems) and runs > into the following error: > {noformat} > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in collect > for test in finder.find(module): > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in find > extraglobs) > [...]/lib/python3.7/doctest.py:932: in find > self._find(tests, obj, name, module, source_lines, globs, {}) > [...]/lib/python3.7/doctest.py:993: in _find > self._from_module(module, val)): > [...]/lib/python3.7/doctest.py:960: in _from_module > return module._name_ == object._module_ > E AttributeError: _module_{noformat} > > In doctest > ([https://github.com/python/cpython/blob/master/Lib/doctest.py#L959]), the > {code:java} > inspect.isclass(object) {code} > condition at line 959 returns `True`, and therefore doctest tries to access > the object's __module__ attribute, which does not seem to exist. > Besides, pytest prints a warning for each Java class being wrapped, also > because they have no __module__ attribute (this is one example of 1000+ > warnings): > {noformat} > [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: builtin > type ExtendedKalmanFilter has no __module_ attribute > return f(*args, **kwds){noformat} > This phenomenon is new because 6 months ago I could run pytest & doctest > successfully with Orekit. I could not find which module contains the change > that broke stuff since then though. > To reproduce the phenomenon, you can check out > [https://github.com/GorgiAstro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/test_propagation.py#L164] > I was trying to validate some poliastro features using the Orekit python > wrapper. So this code requires poliastro, it is available on conda-forge. > Cheers > Clément -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
[ https://issues.apache.org/jira/browse/PYLUCENE-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16953272#comment-16953272 ] Andreas Vajda commented on PYLUCENE-51: --- I added the setting of type._ _ module_ _ in installType() (python 3 only). This should fix the bug, please verify that the issue with doctest is resolved. In python 3: >>> from lucene import initVM >>> initVM() >>> from org.apache.lucene.document import Document >>> Document.__module__ 'org.apache.lucene.document' >>> > "AttributeError: __module__" when running doctest > - > > Key: PYLUCENE-51 > URL: https://issues.apache.org/jira/browse/PYLUCENE-51 > Project: PyLucene > Issue Type: Bug > Environment: Ubuntu 19.04, Python 3.7 >Reporter: Clément Jonglez >Priority: Major > > Dear all, > I am using the Orekit Python wrapper by [~petrush] . I am running into errors > & warnings when trying to run tests with doctest. When collecting tests, it > analyzes the classes (all the 1000+ wrapped Java classes it seems) and runs > into the following error: > {noformat} > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in collect > for test in finder.find(module): > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in find > extraglobs) > [...]/lib/python3.7/doctest.py:932: in find > self._find(tests, obj, name, module, source_lines, globs, {}) > [...]/lib/python3.7/doctest.py:993: in _find > self._from_module(module, val)): > [...]/lib/python3.7/doctest.py:960: in _from_module > return module._name_ == object._module_ > E AttributeError: _module_{noformat} > > In doctest > ([https://github.com/python/cpython/blob/master/Lib/doctest.py#L959]), the > {code:java} > inspect.isclass(object) {code} > condition at line 959 returns `True`, and therefore doctest tries to access > the object's __module__ attribute, which does not seem to exist. > Besides, pytest prints a warning for each Java class being wrapped, also > because they have no __module__ attribute (this is one example of 1000+ > warnings): > {noformat} > [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: builtin > type ExtendedKalmanFilter has no __module_ attribute > return f(*args, **kwds){noformat} > This phenomenon is new because 6 months ago I could run pytest & doctest > successfully with Orekit. I could not find which module contains the change > that broke stuff since then though. > To reproduce the phenomenon, you can check out > [https://github.com/GorgiAstro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/test_propagation.py#L164] > I was trying to validate some poliastro features using the Orekit python > wrapper. So this code requires poliastro, it is available on conda-forge. > Cheers > Clément -- This message was sent by Atlassian Jira (v8.3.4#803005)
Re: [jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
On Wed, 16 Oct 2019, Andi Vajda wrote: On Wed, 16 Oct 2019, Petrus Hyvönen (Jira) wrote: Looks like the name in a PyTypeObject tp_name should be of form "module.name", and module is automagically assigned to __module__. I think this is done for some of the special classes but not for the wrapped classes if I understand correctly. I tried to add a "jcc." in front of the name and it seems to propagate to the __module__ parameter. However this should preferably be the wrapped module path instead of just "jcc", is there a good way to extract this path? One way could be to have a new parameter, module to the DEFINE_TYPE but that would require a bit of changes all around. In other words, instead of generating DEFINE_TYPE(SpanFirstBuilder, t_SpanFirstBuilder, SpanFirstBuilder); JCC should generate something like DEFINE_TYPE(org.apache.lucene.queryparser.xml.SpanFirstBuilder, t_SpanFirstBuilder, SpanFirstBuilder); That should simple enough to fix... Let me give it a quick try. Or, even simpler, just set in inside installType(). Andi..
Re: [jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
On Wed, 16 Oct 2019, Petrus Hyvönen (Jira) wrote: Looks like the name in a PyTypeObject tp_name should be of form "module.name", and module is automagically assigned to __module__. I think this is done for some of the special classes but not for the wrapped classes if I understand correctly. I tried to add a "jcc." in front of the name and it seems to propagate to the __module__ parameter. However this should preferably be the wrapped module path instead of just "jcc", is there a good way to extract this path? One way could be to have a new parameter, module to the DEFINE_TYPE but that would require a bit of changes all around. In other words, instead of generating DEFINE_TYPE(SpanFirstBuilder, t_SpanFirstBuilder, SpanFirstBuilder); JCC should generate something like DEFINE_TYPE(org.apache.lucene.queryparser.xml.SpanFirstBuilder, t_SpanFirstBuilder, SpanFirstBuilder); That should simple enough to fix... Let me give it a quick try. Andi..
[jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
[ https://issues.apache.org/jira/browse/PYLUCENE-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16953191#comment-16953191 ] Petrus Hyvönen commented on PYLUCENE-51: Hi, Looks like the name in a PyTypeObject tp_name should be of form "module.name", and module is automagically assigned to __module__. I think this is done for some of the special classes but not for the wrapped classes if I understand correctly. I tried to add a "jcc." in front of the name and it seems to propagate to the __module__ parameter. However this should preferably be the wrapped module path instead of just "jcc", is there a good way to extract this path? One way could be to have a new parameter, module to the DEFINE_TYPE but that would require a bit of changes all around. from the macros.h file: #define DEFINE_TYPE(name, t_name, javaClass) \ PyType_Def PY_TYPE_DEF(name) = { \ { \ "jcc." #name, \ /* default is #name added the "jcc." part sizeof(t_name), \ 0, \ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, \ PY_TYPE_SLOTS(name) \ }, \ NULL, \ PY_TYPE_BASES(name), \ }; > "AttributeError: __module__" when running doctest > - > > Key: PYLUCENE-51 > URL: https://issues.apache.org/jira/browse/PYLUCENE-51 > Project: PyLucene > Issue Type: Bug > Environment: Ubuntu 19.04, Python 3.7 >Reporter: Clément Jonglez >Priority: Major > > Dear all, > I am using the Orekit Python wrapper by [~petrush] . I am running into errors > & warnings when trying to run tests with doctest. When collecting tests, it > analyzes the classes (all the 1000+ wrapped Java classes it seems) and runs > into the following error: > {noformat} > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in collect > for test in finder.find(module): > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in find > extraglobs) > [...]/lib/python3.7/doctest.py:932: in find > self._find(tests, obj, name, module, source_lines, globs, {}) > [...]/lib/python3.7/doctest.py:993: in _find > self._from_module(module, val)): > [...]/lib/python3.7/doctest.py:960: in _from_module > return module._name_ == object._module_ > E AttributeError: _module_{noformat} > > In doctest > ([https://github.com/python/cpython/blob/master/Lib/doctest.py#L959]), the > {code:java} > inspect.isclass(object) {code} > condition at line 959 returns `True`, and therefore doctest tries to access > the object's __module__ attribute, which does not seem to exist. > Besides, pytest prints a warning for each Java class being wrapped, also > because they have no __module__ attribute (this is one example of 1000+ > warnings): > {noformat} > [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: builtin > type ExtendedKalmanFilter has no __module_ attribute > return f(*args, **kwds){noformat} > This phenomenon is new because 6 months ago I could run pytest & doctest > successfully with Orekit. I could not find which module contains the change > that broke stuff since then though. > To reproduce the phenomenon, you can check out > [https://github.com/GorgiAstro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/test_propagation.py#L164] > I was trying to validate some poliastro features using the Orekit python > wrapper. So this code requires poliastro, it is available on conda-forge. > Cheers > Clément -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
[ https://issues.apache.org/jira/browse/PYLUCENE-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16952332#comment-16952332 ] Clément Jonglez commented on PYLUCENE-51: - Thank you Petrus for investigating and for the clarification, this is indeed JCC-related and not only about Orekit. > "AttributeError: __module__" when running doctest > - > > Key: PYLUCENE-51 > URL: https://issues.apache.org/jira/browse/PYLUCENE-51 > Project: PyLucene > Issue Type: Bug > Environment: Ubuntu 19.04, Python 3.7 >Reporter: Clément Jonglez >Priority: Major > > Dear all, > I am using the Orekit Python wrapper by [~petrush] . I am running into errors > & warnings when trying to run tests with doctest. When collecting tests, it > analyzes the classes (all the 1000+ wrapped Java classes it seems) and runs > into the following error: > {noformat} > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in collect > for test in finder.find(module): > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in find > extraglobs) > [...]/lib/python3.7/doctest.py:932: in find > self._find(tests, obj, name, module, source_lines, globs, {}) > [...]/lib/python3.7/doctest.py:993: in _find > self._from_module(module, val)): > [...]/lib/python3.7/doctest.py:960: in _from_module > return module._name_ == object._module_ > E AttributeError: _module_{noformat} > > In doctest > ([https://github.com/python/cpython/blob/master/Lib/doctest.py#L959]), the > {code:java} > inspect.isclass(object) {code} > condition at line 959 returns `True`, and therefore doctest tries to access > the object's __module__ attribute, which does not seem to exist. > Besides, pytest prints a warning for each Java class being wrapped, also > because they have no __module__ attribute (this is one example of 1000+ > warnings): > {noformat} > [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: builtin > type ExtendedKalmanFilter has no __module_ attribute > return f(*args, **kwds){noformat} > This phenomenon is new because 6 months ago I could run pytest & doctest > successfully with Orekit. I could not find which module contains the change > that broke stuff since then though. > To reproduce the phenomenon, you can check out > [https://github.com/GorgiAstro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/test_propagation.py#L164] > I was trying to validate some poliastro features using the Orekit python > wrapper. So this code requires poliastro, it is available on conda-forge. > Cheers > Clément -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
[ https://issues.apache.org/jira/browse/PYLUCENE-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16950464#comment-16950464 ] Petrus Hyvönen commented on PYLUCENE-51: as of Python 3.7.0 A missing _ _ m o d u l e _ _ properties issue a wardning: C API * [bpo-20204|https://bugs.python.org/issue20204]{color:#22}: Deprecation warning is now raised for builtin types without the __module__ attribute.{color} >From <[https://docs.python.org/3.7/whatsnew/changelog.html#python-3-7-0-final]> It seems like in the python 2.7 JCC version has this attribute is set on wrapped object but not when using Python 3.6 or 3.7. I am investigating if PyGetSetDef can be used for this. > "AttributeError: __module__" when running doctest > - > > Key: PYLUCENE-51 > URL: https://issues.apache.org/jira/browse/PYLUCENE-51 > Project: PyLucene > Issue Type: Bug > Environment: Ubuntu 19.04, Python 3.7 >Reporter: Clément Jonglez >Priority: Major > > Dear all, > I am using the Orekit Python wrapper by [~petrush] . I am running into errors > & warnings when trying to run tests with doctest. When collecting tests, it > analyzes the classes (all the 1000+ wrapped Java classes it seems) and runs > into the following error: > {noformat} > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in collect > for test in finder.find(module): > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in find > extraglobs) > [...]/lib/python3.7/doctest.py:932: in find > self._find(tests, obj, name, module, source_lines, globs, {}) > [...]/lib/python3.7/doctest.py:993: in _find > self._from_module(module, val)): > [...]/lib/python3.7/doctest.py:960: in _from_module > return module._name_ == object._module_ > E AttributeError: _module_{noformat} > > In doctest > ([https://github.com/python/cpython/blob/master/Lib/doctest.py#L959]), the > {code:java} > inspect.isclass(object) {code} > condition at line 959 returns `True`, and therefore doctest tries to access > the object's __module__ attribute, which does not seem to exist. > Besides, pytest prints a warning for each Java class being wrapped, also > because they have no __module__ attribute (this is one example of 1000+ > warnings): > {noformat} > [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: builtin > type ExtendedKalmanFilter has no __module_ attribute > return f(*args, **kwds){noformat} > This phenomenon is new because 6 months ago I could run pytest & doctest > successfully with Orekit. I could not find which module contains the change > that broke stuff since then though. > To reproduce the phenomenon, you can check out > [https://github.com/GorgiAstro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/test_propagation.py#L164] > I was trying to validate some poliastro features using the Orekit python > wrapper. So this code requires poliastro, it is available on conda-forge. > Cheers > Clément -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
[ https://issues.apache.org/jira/browse/PYLUCENE-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16949211#comment-16949211 ] Petrus Hyvönen commented on PYLUCENE-51: Hi! I will try to find what is going on, I have noticed these warnings appeared in PyCharm too. In a quick run I find that under python 2.7 the classes (JCC wrapped java classes) do have a "__module__" property that is set to "__builtin__" while in current 3.7 it returns Attribute Error. But may be a difference between 2 and 3 in general, don't know yet, I will try to dig in it a bit and see where the problem is. > "AttributeError: __module__" when running doctest > - > > Key: PYLUCENE-51 > URL: https://issues.apache.org/jira/browse/PYLUCENE-51 > Project: PyLucene > Issue Type: Bug > Environment: Ubuntu 19.04, Python 3.7 >Reporter: Clément Jonglez >Priority: Major > > Dear all, > I am using the Orekit Python wrapper by [~petrush] . I am running into errors > & warnings when trying to run tests with doctest. When collecting tests, it > analyzes the classes (all the 1000+ wrapped Java classes it seems) and runs > into the following error: > {noformat} > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in collect > for test in finder.find(module): > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in find > extraglobs) > [...]/lib/python3.7/doctest.py:932: in find > self._find(tests, obj, name, module, source_lines, globs, {}) > [...]/lib/python3.7/doctest.py:993: in _find > self._from_module(module, val)): > [...]/lib/python3.7/doctest.py:960: in _from_module > return module._name_ == object._module_ > E AttributeError: _module_{noformat} > > In doctest > ([https://github.com/python/cpython/blob/master/Lib/doctest.py#L959]), the > {code:java} > inspect.isclass(object) {code} > condition at line 959 returns `True`, and therefore doctest tries to access > the object's __module__ attribute, which does not seem to exist. > Besides, pytest prints a warning for each Java class being wrapped, also > because they have no __module__ attribute (this is one example of 1000+ > warnings): > {noformat} > [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: builtin > type ExtendedKalmanFilter has no __module_ attribute > return f(*args, **kwds){noformat} > This phenomenon is new because 6 months ago I could run pytest & doctest > successfully with Orekit. I could not find which module contains the change > that broke stuff since then though. > To reproduce the phenomenon, you can check out > [https://github.com/GorgiAstro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/test_propagation.py#L164] > I was trying to validate some poliastro features using the Orekit python > wrapper. So this code requires poliastro, it is available on conda-forge. > Cheers > Clément -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest
[ https://issues.apache.org/jira/browse/PYLUCENE-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16949036#comment-16949036 ] Andreas Vajda commented on PYLUCENE-51: --- This site is about bugs in PyLucene and JCC not Orekit. Please, contact Petrus directly about Orekit issues. JCC does not, did not, set __module__ on anything ever. JCC did set module.__dir__ in the past until Python 3 grabbed __dir__ in PEP 562. It now sets module.__module_dir__ in Python 3. In Python 2, it still sets module.__dir__. > "AttributeError: __module__" when running doctest > - > > Key: PYLUCENE-51 > URL: https://issues.apache.org/jira/browse/PYLUCENE-51 > Project: PyLucene > Issue Type: Bug > Environment: Ubuntu 19.04, Python 3.7 >Reporter: Clément Jonglez >Priority: Major > > Dear all, > I am using the Orekit Python wrapper by [~petrush] . I am running into errors > & warnings when trying to run tests with doctest. When collecting tests, it > analyzes the classes (all the 1000+ wrapped Java classes it seems) and runs > into the following error: > {noformat} > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in collect > for test in finder.find(module): > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in find > extraglobs) > [...]/lib/python3.7/doctest.py:932: in find > self._find(tests, obj, name, module, source_lines, globs, {}) > [...]/lib/python3.7/doctest.py:993: in _find > self._from_module(module, val)): > [...]/lib/python3.7/doctest.py:960: in _from_module > return module._name_ == object._module_ > E AttributeError: _module_{noformat} > > In doctest > ([https://github.com/python/cpython/blob/master/Lib/doctest.py#L959]), the > {code:java} > inspect.isclass(object) {code} > condition at line 959 returns `True`, and therefore doctest tries to access > the object's __module__ attribute, which does not seem to exist. > Besides, pytest prints a warning for each Java class being wrapped, also > because they have no __module__ attribute (this is one example of 1000+ > warnings): > {noformat} > [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: builtin > type ExtendedKalmanFilter has no __module_ attribute > return f(*args, **kwds){noformat} > This phenomenon is new because 6 months ago I could run pytest & doctest > successfully with Orekit. I could not find which module contains the change > that broke stuff since then though. > To reproduce the phenomenon, you can check out > [https://github.com/GorgiAstro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/test_propagation.py#L164] > I was trying to validate some poliastro features using the Orekit python > wrapper. So this code requires poliastro, it is available on conda-forge. > Cheers > Clément -- This message was sent by Atlassian Jira (v8.3.4#803005)