osm-fr / osmose-backend

Part of osmose that runs the analysis, and send the results to the frontend.
GNU General Public License v3.0
92 stars 115 forks source link

backend fails with "global name 'source' is not defined" #162

Closed stephankn closed 7 years ago

stephankn commented 7 years ago

Might be related to this 72cab020d1d97af5f6425b36b757283999f2c216

Name_Script.py line 39

I unfortunately can't paste the backtrace as text. Please double-check the above line for syntax. Python here is 2.7.6 in case it matters.

image

frodrigo commented 7 years ago

I already seen this error. It's an error in the module regex (not re). It happens when a class or a block is not know by the regex module. Probably an issue with the version of regex module.

Here Python 2.7.9 with regex 2.4.53

$ python2.7
>>> import regex
>>> regex.__version__
'2.4.53'
stephankn commented 7 years ago

Ubuntu 14.04 LTS seems to be a bit older. Python 2.7.6 with regex 2.4.41

can this be worked around? Or maybe 72cab020d1d97af5f6425b36b757283999f2c216 reverted until this is resolved? To what extend will it impact the processing and uploading of results?

frodrigo commented 7 years ago

I found a better way to write the same thing, can you check this works for you ?

$ python2.7
>>> import regex
>>> other_symbol = regex.compile(u"[[\p{General_Category=Other_Symbol}]--[\p{Block=Latin 1 Supplement}\p{Block=Braille Patterns}\p{Block=CJK Radicals Supplement}\p{Block=Kangxi Radicals}\p{Block=CJK Strokes}]--[↔→◄►]]", flags=regex.V1)
>>>
stephankn commented 7 years ago

@frodrigo 👍 confirm. Your alternative writing is accepted without error.

>>> other_symbol = regex.compile(u"[[\p{General_Category=Other_Symbol}]--[\p{Block=Latin 1 Supplement}\p{Block=Braille Patterns}\p{Block=CJK Radicals Supplement}\p{Block=Kangxi Radicals}\p{Block=CJK Strokes}]--[↔→◄►]]", flags=regex.V1)
>>> other_symbol
regex.Regex(u'[[\\p{General_Category=Other_Symbol}]--[\\p{Block=Latin 1 Supplement}\\p{Block=Braille Patterns}\\p{Block=CJK Radicals Supplement}\\p{Block=Kangxi Radicals}\\p{Block=CJK Strokes}]--[\u2194\u2192\u25c4\u25ba]]', flags=regex.F | regex.U | regex.V1)