MolSSI-BSE / basis_set_exchange

A repository for quantum chemistry basis sets
https://molssi-bse.github.io/basis_set_exchange/
BSD 3-Clause "New" or "Revised" License
151 stars 44 forks source link

"SyntaxError: invalid escape sequence \s" when import v0.9.1 API as a module #294

Open chemsh opened 6 months ago

chemsh commented 6 months ago

Dear BSE developers,

we find when importing the BSE Python API v0.9 or v0.9.1 as a module in Py-ChemShell by

from .src.build.lib import basis_set_exchange

the Python3 interpreter (v3.8.10) reports a few errors of

SyntaxError: invalid escape sequence \s

in src/basis_set_exchange/ints.py

due to the multiple docstrings containing content

\sum_ which should be \\sum_

and similar issues of escapes \s and \d are found in the lines

# Start for new basis entry
basis_head_re = re.compile(r'^/([a-zA-Z]+).({}|)....(aCD|acCD)-aux-basis.\s*$'.format(helpers.basis_name_re_str))
# Elemental charge, lmax, number of basis set blocks
charge_line_re = re.compile(r'^\s*({})\s+(\d+)\s+(\d+)\s*$'.format(helpers.floating_re_str))
dummy_line_re = re.compile(r'^\s*Dummy reference line.\s*$')
# nprim, ncontr, functype
shell_start_re = re.compile('^\s*(\d+)\s+(\d+)\s+(\d+)\s*$')

# Floating point data
array_data_re = re.compile(r'^\s*(?:\s({}))+\s*$'.format(helpers.floating_re_str))

of src/basis_set_exchange/readers/ricdlib.py

We appreciate if you could have this fixed.

Happy Christmas!

You

bennybp commented 6 months ago

Hello

I can't reproduce on any python version for whatever reason, but these are indeed issues. I've opened a PR to fix them (#297)

chemsh commented 6 months ago

Hello

I can't reproduce on any python version for whatever reason, but these are indeed issues. I've opened a PR to fix them (#297)

Much appreciated!