wikiextractor icon indicating copy to clipboard operation
wikiextractor copied to clipboard

error with" global flags not at the start of the expression at position 4" help~~~

Open JoeyHuhuu opened this issue 1 year ago • 7 comments

Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in run_code File "D:\Python\Lib\site-packages\wikiextractor\WikiExtractor.py", line 66, in from extract import Extractor, ignoreTag, define_template, acceptedNamespaces File "D:\Python\Lib\site-packages\wikiextractor\extract.py", line 378, in ExtLinkBracketedRegex = re.compile( ^^^^^^^^^^^ File "D:\Python\Lib\re_init.py", line 228, in compile return compile(pattern, flags) ^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\re_init.py", line 307, in _compile p = _compiler.compile(pattern, flags) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\re_compiler.py", line 743, in compile p = _parser.parse(p, flags) ^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\re_parser.py", line 972, in parse p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\re_parser.py", line 453, in _parse_sub itemsappend(_parse(source, state, verbose, nested + 1, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\re_parser.py", line 855, in _parse p = _parse_sub(source, state, sub_verbose, nested + 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\re_parser.py", line 453, in _parse_sub itemsappend(_parse(source, state, verbose, nested + 1, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\re_parser.py", line 855, in _parse p = _parse_sub(source, state, sub_verbose, nested + 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\re_parser.py", line 453, in _parse_sub itemsappend(_parse(source, state, verbose, nested + 1, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python\Lib\re_parser.py", line 833, in _parse raise source.error('global flags not at the start ' re.error: global flags not at the start of the expression at position 4

JoeyHuhuu avatar Aug 29 '24 07:08 JoeyHuhuu

Same here

VladOnMyOwn avatar Aug 31 '24 12:08 VladOnMyOwn

@JoeyHuhuu, try this: https://github.com/attardi/wikiextractor/pull/313/commits/ab8988ebfa9e4557411f3d4c0f4ccda139e18875 helped me

VladOnMyOwn avatar Aug 31 '24 12:08 VladOnMyOwn

@JoeyHuhuu, try this: ab8988e ,请尝试以下操作: ab8988e helped me 帮助了我

thank you~

JoeyHuhuu avatar Sep 06 '24 06:09 JoeyHuhuu

Thanks, worked for me too with python 3.12, after pip uninstall wikiextractor followed by pip install git+https://github.com/attardi/wikiextractor.git@ab8988ebfa9e4557411f3d4c0f4ccda139e18875

Then python -m wikiextractor.WikiExtractor <Wikipedia xml file> worked as before.

Thanks for this fix, it would be good if it could be merged into the pypi release. (Depends on https://github.com/attardi/wikiextractor/issues/335 I guess?)

dwiddows avatar Oct 08 '24 16:10 dwiddows

I am getting this error that setuptools aren't available. I am using the script in a conda env with Python v3.11.7

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
      [end of output]

Any suggestions?

janarosmonaliev avatar Nov 18 '24 01:11 janarosmonaliev

@janarosmonaliev try https://github.com/attardi/wikiextractor/commit/ab8988ebfa9e4557411f3d4c0f4ccda139e18875 and replace wikiextractor/extract.py with that file. Worked for me!

weezymatt avatar Mar 05 '25 08:03 weezymatt

I have the same problem, it would be great if the pypi version were updated!

tom9358 avatar Mar 18 '25 10:03 tom9358