NVSeismoLab / qmlutil

QuakeML utilities for python
Apache License 2.0
6 stars 6 forks source link

Python 3? #2

Closed jkmacc-LANL closed 4 years ago

jkmacc-LANL commented 6 years ago

Hello,

It seems that qmlutil is targeting Python 2, but this isn't explicit in the setup.py. In Python 3, I get the following runtime error using 01 as an integer intput into datetime.datetime:

In [3]: import qmlutil
Traceback (most recent call last):

  File "/.../site-packages/IPython/core/interactiveshell.py", line 2862, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-3-9cbe93fc0ea8>", line 1, in <module>
    import qmlutil

  File "/.../site-packages/qmlutil/__init__.py", line 29, in <module>
    from qmlutil.core import (Root, ResourceURIGenerator, timestamp2isostr,

  File "/.../site-packages/qmlutil/core.py", line 52
    return (dt-datetime.datetime(1970, 01, 01, 00, 00, 00)).total_seconds()
                                        ^
SyntaxError: invalid token

I've fixed this error in the 3 or so places where it is found, but the tests produce a string error:

INTERNALERROR>   File "/.../qmlutil/tests/conftest.py", line 7, in pytest_report_header
INTERNALERROR>     return "QuakeML test runner: qmlutil" + '\n' + freeze
INTERNALERROR> TypeError: must be str, not bytes

So, it seems that this is currently Python 2 only. Are there plans for a Python 3 version?

markcwill commented 6 years ago

@jkmacc-LANL, this module was created by our lab for the express purpose of converting Antelope databases to QuakeML. Our main use case is to use the Antelope Python modules to query data. BRTT's distributed python modules only work with Python 2.7. As far as I know, BRTT has no Python 3 roadmap.

I'm sorry that isn't made clear anywhere. This is not a community developed package, we open-sourced it at the request of some other Antelope users, so the Python 2.7 is implied. I'll make a note of this internally, and put it on our list of possible python3 migration projects. If there is wider use in the community for this, I think it would be good to maintain for the future.

jkmacc-LANL commented 6 years ago

Thanks for responding. I actually see a few forks of it, some of which look like they’re active. Much appreciated.