-
Notifications
You must be signed in to change notification settings - Fork 630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make mapfiles error #2221
Comments
I don't understand what's going on, could you apply the following diff to the script, rerun and post the output? diff --git a/scripts/gen_mapfiles.py b/scripts/gen_mapfiles.py
index 5fd084ad..1842ace6 100644
--- a/scripts/gen_mapfiles.py
+++ b/scripts/gen_mapfiles.py
@@ -15,6 +15,8 @@ import sys
top_src_dir = Path(__file__).parent.parent
pygments_package = top_src_dir / 'pygments'
+print(__file__, top_src_dir, pygments_package, pygments_package.resolve(), pygments_package.resolve().exists(),
+ pygments_package.resolve().is_dir())
sys.path.insert(0, pygments_package.parent.resolve())
from pygments.util import docstring_headline |
Same result at the end (obvs), but it now starts with: HTH |
Thanks. I am even more puzzled. How can the message “The system cannot find the path specified” come even before any path operation is done? I suspect you might have some strangeness in your environment… If you comment out everything after the given |
By the way, what is your Python version? |
OK, let's step back a minute. The opening error is a potential clue, but not a blocking problem, whereas the final one is. I now believe the opening error occurs somewhere within make itself: However, it looks like make is coping/ignoring it and carrying on. Re-running "choco install make" has no effect whatsoever. So (with all WSL attempts abandoned) my question now is: should running python3 scripts/gen_mapfiles.py directly work? E:\downloads\misc\pygments>py There are other versions of python on this box too, but since my path starts as follows: I struggle to imagine why they'd be a problem, plus under WSL I tried both 2.7.6 and 3.4.3, to no avail. I suspect I'm just simply going to have to submit a pull request but without running any of the tests.. |
Regarding the problem with When running under WSL, you have to use a reasonably current Python version. Currently, we support Python 3.6 and later. It's not surprising that it doesn't work with Python 2 or 3.4. What I have not understood yet is why you get an error running the script with Python 3.10. |
What is the result if you do this? diff --git a/scripts/gen_mapfiles.py b/scripts/gen_mapfiles.py
index 5fd084ad..6bdead41 100644
--- a/scripts/gen_mapfiles.py
+++ b/scripts/gen_mapfiles.py
@@ -16,7 +16,8 @@ import sys
top_src_dir = Path(__file__).parent.parent
pygments_package = top_src_dir / 'pygments'
sys.path.insert(0, pygments_package.parent.resolve())
-
+import pygments
+print(pygments.__file__)
from pygments.util import docstring_headline
def main(): |
I can confirm that file does exist, and it is version 2.13.0, and in fact identical to the one in Also, I've run "make -d" which seems to confirm your suspicion regarding the makefile being Windows-unfriendly:
So, yeah, I'd guess that initial message just means that /dev/null does not exist on Windows, and cmd.exe cops out when it cannot redirect the error output without even running that line. The offending line is export PYTHONPATH in the makefile, I tried removing just the 2> part but got slapped with "SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?", so instead removed the whole line (and set PYTHONPATH manually) and, lo, the initial red herring error has gone. |
Yes, the script should be loading everything from your local version of Pygments in diff --git a/scripts/gen_mapfiles.py b/scripts/gen_mapfiles.py
index 5fd084ad..cf7984ba 100644
--- a/scripts/gen_mapfiles.py
+++ b/scripts/gen_mapfiles.py
@@ -9,14 +9,22 @@
"""
from importlib import import_module
+from importlib.util import *
from pathlib import Path
import re
import sys
top_src_dir = Path(__file__).parent.parent
pygments_package = top_src_dir / 'pygments'
-sys.path.insert(0, pygments_package.parent.resolve())
-
+pygments_init = pygments_package / '__init__.py'
+spec = spec_from_file_location('pygments', pygments_init)
+pygments = module_from_spec(spec)
+sys.modules['pygments'] = pygments
+spec.loader.exec_module(pygments)
+assert pygments.__file__ == pygments_init
+
+#sys.path.insert(0, pygments_package.parent.resolve())
+#import pygments
from pygments.util import docstring_headline
def main(): |
We're getting there! On the first attempt, the assert failed, so I inserted before it:
yet still got
Which rather confuses me, but anyway I commented out the assert... and it ran through without any further error (Yay!) |
I might have understood the cause for this. Does this work? diff --git a/scripts/gen_mapfiles.py b/scripts/gen_mapfiles.py
index 5fd084ad..a5aed0ca 100644
--- a/scripts/gen_mapfiles.py
+++ b/scripts/gen_mapfiles.py
@@ -15,7 +15,7 @@ import sys
top_src_dir = Path(__file__).parent.parent
pygments_package = top_src_dir / 'pygments'
-sys.path.insert(0, pygments_package.parent.resolve())
+sys.path.insert(0, str(pygments_package.parent.resolve()))
from pygments.util import docstring_headline
|
I really looks correct, so I've opened #2223. |
Thanks, that works. Of course I've just run headlong into make tests.
Hopefully that's something rather similar |
You're just missing dependencies in your development environment. You need to run |
Thanks, that helped. I left pytest running for about five hours before investigating further, and it was stuck in an infinite loop trying to create some temp files in Program Files\Python310, so I granted it access permissions and it then finished ok. |
Seems to me like it's saying that it can't find the thing that it just found:
ProcMon says it's looking for E:\downloads\misc\pygments\<frozen importlib._bootstrap> and getting NAME_INVALID.
The text was updated successfully, but these errors were encountered: