xraypy / xraylarch

Larch: Applications and Python Library for Data Analysis of X-ray Absorption Spectroscopy (XAS, XANES, XAFS, EXAFS), X-ray Fluorescence (XRF) Spectroscopy and Imaging, and more.
https://xraypy.github.io/xraylarch
Other
127 stars 62 forks source link

SyntaxError: unexpected character after line continuation character #482

Closed picca closed 3 months ago

picca commented 6 months ago

Hello, while preparing the Debian package of the 0.9.74 version, I got this error message

Setting up python3-xraylarch (0.9.74+ds1-1) ...
/usr/lib/python3/dist-packages/larch/math/transformations.py:33: SyntaxWarning: invalid escape sequence '\*'
  """Homogeneous Transformation Matrices and Quaternions.
/usr/lib/python3/dist-packages/larch/math/transformations.py:890: SyntaxWarning: invalid escape sequence '\*'
  """Return affine transform matrix to register two point sets.
/usr/lib/python3/dist-packages/larch/math/transformations.py:999: SyntaxWarning: invalid escape sequence '\*'
  """Return matrix to transform given 3D point set into second point set.
/usr/lib/python3/dist-packages/larch/wxxrd/XRD1Dviewer.py:585: SyntaxWarning: invalid escape sequence '\A'
  self.xlabel    = 'q (1/$\AA$)' #'q (A^-1)'
/usr/lib/python3/dist-packages/larch/wxxrd/XRD1Dviewer.py:1289: SyntaxWarning: invalid escape sequence '\A'
  self.xlabel = 'd ($\AA$)'
/usr/lib/python3/dist-packages/larch/wxxrd/XRD1Dviewer.py:1297: SyntaxWarning: invalid escape sequence '\A'
  self.xlabel = 'q (1/$\AA$)'
/usr/lib/python3/dist-packages/larch/wxxrd/XRD1Dviewer.py:1701: SyntaxWarning: invalid escape sequence '\A'
  self.xlabel       = 'q (1/$\AA$)' #'q (A^-1)'
/usr/lib/python3/dist-packages/larch/wxxrd/XRD1Dviewer.py:2126: SyntaxWarning: invalid escape sequence '\A'
  self.xlabel = 'd ($\AA$)'
/usr/lib/python3/dist-packages/larch/wxxrd/XRD1Dviewer.py:2132: SyntaxWarning: invalid escape sequence '\A'
  self.xlabel = 'q (1/$\AA$)'
/usr/lib/python3/dist-packages/larch/xafs/feffrunner.py:200: SyntaxWarning: invalid escape sequence '\s'
  pattern = re.compile('mu_(new|old)=\s+(-?\d\.\d+)')
/usr/lib/python3/dist-packages/larch/xafs/pre_edge.py:20: SyntaxWarning: invalid escape sequence '\m'
  """calculate :math:`E_0`, the energy threshold of absorption, or
  File "/usr/lib/python3/dist-packages/larch/xsw/YongsCode/SimpleParratt_Panel.py", line 311
    print('%4.1f \t %s \t %4.4f \t %4.4f \t %4.1f \t %s\n' % \)
                                                              ^
SyntaxError: unexpected character after line continuation character
  File "/usr/lib/python3/dist-packages/larch/xsw/YongsCode/SimpleParratt_Panel.py", line 311
    print('%4.1f \t %s \t %4.4f \t %4.4f \t %4.1f \t %s\n' % \)
                                                              ^
SyntaxError: unexpected character after line continuation character
dpkg: error processing package python3-xraylarch (--configure):
 installed python3-xraylarch package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of autopkgtest-satdep:
 autopkgtest-satdep depends on python3-xraylarch; however:
  Package python3-xraylarch is not configured yet.

Cheers

newville commented 6 months ago

@picca Thanks, but, I don't understand what command gives those messages and errors. Can you give a more complete report of what you did?

picca commented 6 months ago

When you install a module on Debian, it install the .py files

then it runn this

#!/bin/sh
set -e

# Automatically added by dh_python3
if command -v py3compile >/dev/null 2>&1; then
        py3compile -p python3-numpy:amd64 
fi
if command -v pypy3compile >/dev/null 2>&1; then
        pypy3compile -p python3-numpy:amd64  || true
fi

# End automatically added section

This generate all the .pyc files from the .py files

This is during this process thaht it found this SyntaxError.

I solved it with this patch

https://salsa.debian.org/science-team/xraylarch/-/blob/master/debian/patches/0010-fix-syntax-error.patch?ref_type=heads

look at the end of the line :))

newville commented 6 months ago

@picca thanks, that's very helpful. I'll investigete and fix those.

maurov commented 3 months ago

@newville is this fixed? Can I tag it for 0.9.75?

newville commented 3 months ago

@maurov, yes... now fixed, and closing.