You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When on Windows, there are a few lines with syntax errors in validators.py
> py -m app
Traceback (most recent call last):
File "C:\Users\golya\AppData\Local\Programs\Python\Python37\Lib\runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Users\golya\AppData\Local\Programs\Python\Python37\Lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:\Users\golya\AppData\Local\Programs\Python\Python37\Lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "C:\Users\golya\git\tournaments\app\__init__.py", line 10, in <module>
from . import db
File "C:\Users\golya\git\tournaments\app\db.py", line 1, in <module>
from sqlobject.sqlite.sqliteconnection import SQLiteConnection
File "C:\Users\golya\.virtualenvs\tournaments-O-Cvtk8m\lib\site-packages\sqlobject\__init__.py", line 8, in <module>
from .col import * # noqa
File "C:\Users\golya\.virtualenvs\tournaments-O-Cvtk8m\lib\site-packages\sqlobject\col.py", line 33, in <module>
from formencode import compound, validators
File "C:\Users\golya\.virtualenvs\tournaments-O-Cvtk8m\lib\site-packages\formencode\__init__.py", line 9, in <module>
from formencode import validators
File "C:\Users\golya\.virtualenvs\tournaments-O-Cvtk8m\lib\site-packages\formencode\validators.py", line 5730
^
SyntaxError: invalid syntax
The line counting of the reported syntax error is incorrect. If you divide the reported line number by two, you get to the actual line in error (line 2865).
The reason for the syntax error is that on line 2865, the backslash is used for line continuation, but the line ends with 0x0D0D0A which is one 0x0D too much and is not tolerated by the Python on Windows.
So the root cause seems to be incorrect line ends in formencode/validator.py. This can also be seen when using vim on Windows to look at the file: It displays "^M" at the end of each line, which it does not do when there are regular Windows-style line ends of 0x0D0A.
This issue exists for (at least) the following files:
formencode/validators.py
formencode/htmlfill.py
Note that I look at the pip-installed copies of these files in a virtualenv for this, not at the source files in the repo.
The strange thing is that these two files have not been updated since 1/2017 and 12/2015, respectively, so I suspect that something else plays a role, in addition.
I don't have much tooling at hand right now to investigate further, but will do so later today.
Which release of 3.7 were you seeing this on? This looks a lot like python/cpython#6483 (comment) , which means the issue should only be present with 3.7.0 .
I'm sorry, it's been over a year, and I currently have no way to easily replicate the issue without writing some code. I may get to it later in the day, but no promises.
I have verified that I can reproduce this with Python 3.7.0 on windows 10, but not with the current release (3.7.8), so I believe this isn't a formencode bug.
Activity
andy-maier commentedon Feb 2, 2020
I have the same issue with Python 3.7 on Windows.
After some investigation, I found the following:
So the root cause seems to be incorrect line ends in formencode/validator.py. This can also be seen when using vim on Windows to look at the file: It displays "^M" at the end of each line, which it does not do when there are regular Windows-style line ends of 0x0D0A.
This issue exists for (at least) the following files:
Note that I look at the pip-installed copies of these files in a virtualenv for this, not at the source files in the repo.
The strange thing is that these two files have not been updated since 1/2017 and 12/2015, respectively, so I suspect that something else plays a role, in addition.
I don't have much tooling at hand right now to investigate further, but will do so later today.
drnlm commentedon Aug 6, 2020
Which release of 3.7 were you seeing this on? This looks a lot like python/cpython#6483 (comment) , which means the issue should only be present with 3.7.0 .
golyalpha commentedon Aug 7, 2020
I'm sorry, it's been over a year, and I currently have no way to easily replicate the issue without writing some code. I may get to it later in the day, but no promises.
drnlm commentedon Aug 7, 2020
I have verified that I can reproduce this with Python 3.7.0 on windows 10, but not with the current release (3.7.8), so I believe this isn't a formencode bug.
golyalpha commentedon Aug 8, 2020
It's quite possible that is in fact the case. Closing the issue.