-
Notifications
You must be signed in to change notification settings - Fork 145
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
DLL load failes after update #356
Comments
Hi @Muerio 👋 Can you send a screenshot for the terminal, in case it works, and in the other case where it doesn't? I am suspecting the commands sent by the extension might have been changed which is leading to this error?
There's no such version. Are you sure that's the correct one? |
Hi @karrtikr
I'm not sure which terminal you want me too screenshot. The Python output terminal only shows pylint commands. I run my code in debug mode using the following configuration in the launch.json:
I updated the version number for the working extension. In the changelog in VS Code it's numbered 2020.6.2 wich is 2020.6.90262 on github. |
Unfortunately I am unable to reproduce this issue, can you provide small reproducible example project, which I can try to reproduce this? Also,
configuration work?
|
The following code is enough to produce the error:
C:/Program Files/FreeCAD 0.18/ is the installation directory for FreeCAD version 0.18.4.
No, it results in the same exception.
Yes, this works. That's why I suspected a bug in the python extension. |
Please have a look at this https://code.visualstudio.com/docs/python/environments#_use-of-the-pythonpath-variable.
Then your modules should be picked from the directory. Meanwhile I'll try to reproduce it. |
@karrtikr did you have any "luck" reproducing the error? |
@Muerio Apologies for the delay. Unfortunately, I am unable to reproduce this. I was able to successfully debug the file as you can notice. I was using Python 3.6.6 64 bit as well. Can you send me a screenshot of when the error pops up? I am interested in the command the extension sends when you try to debug the file, if any, when you use the following configuration.
Please send the above command with both versions. |
@karrtikr I just now had the chance to create the screenshots for you. For privacy reasons I had to black out the user-folder name. Working with version 90262: Debug configuration was the same in both cases:
|
The commands sent to the terminal have not changed for you, except the extension version. I used the latest extension version in my screenshot, so please update the extension version to the latest one |
Please provide the logs as mentioned in the issue template. LogsOutput for
|
I created the logs as described for all three versions we discussed in this thread and made sure to enable source map support after each extension install. The Python output showed nothing for the older versions and for version 2020.7.94776 only showed linting messages. Let me know if you need further information. Version 2020.6.90262
Output Python
Developer Console
Version 2020.6.91350
Output Python
Developer Console Version 2020.7.94776 Traceback (most recent call last):
File "C:\Users\user.name\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\user.name\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Users\user.name\.vscode\extensions\ms-python.python-2020.7.94776\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
cli.main()
File "c:\Users\user.name\.vscode\extensions\ms-python.python-2020.7.94776\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 430, in main
run()
File "c:\Users\user.name\.vscode\extensions\ms-python.python-2020.7.94776\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 267, in run_file
runpy.run_path(options.target, run_name=compat.force_str("__main__"))
File "C:\Users\user.name\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Users\user.name\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Users\user.name\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Users\user.name\Desktop\Python Test\test.py", line 6, in <module>
import FreeCAD as App
ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden. Output Python:
Developer Console |
@Muerio Thanks for your cooperation, however I've run out of ideas here. Please delete all directories matching I'll double check with my team on if they have any other ideas, but if not, I'll have to close this as I cannot reproduce it. I can suggest trying to use a different system and see if you can reproduce it. |
@karrtikr Thank you I deleted the directories but it didn't help. I will keep an eye on it and try with upcoming versions and let you know, if anything changes. |
What happens if you just press F5 after that exception gets reported? Depending on the settings, the debugger will report exceptions as they are raised, even if they're eventually handled - you can continue running in this case. If that's what's happening here, you should see "Done" printed anyway. (It would still be a bug, though, because if FreeCAD is raising the exception internally, and then catching it, it shouldn't be reported.) |
@int19h
"Done" is not printed and to me it doesn't look like a problem with FreeCAD. |
I installed FreeCAD here and I couldn't reproduce this (i.e.: the import works for me with Python 3.6 with the debugger in place). So, let's see if we can get some additional info to diagnose the issue:
i.e.:
i.e.: Run the code below and provide the output in each case:
|
Hello @fabioz
See the following files: Files have been generated with version 2020.6.91350 of the python extension.
For security reasons I can't just post all that information here (company policies). Please let me know if you're interested in specific details of the output from the provided code. I will try to get that information to you. When running the code with the python extension (same version):
When running the code from command line/powershell:
|
@Muerio the important part is not the sys.path nor the PYTHONPATH but the other environment variables... On Windows the important thing is usually the You should make sure that the env is exactly the same on both cases (when running in this version and in the older version) -- I've seen exotic cases where the problem was a faulty DLL in a completely unrelated place due to a CAD vendor or graphics card messing things or sometimes it can be because of a 32/64 mixup... there are endless possibilities there and if you have it running in one place and not in the other, it usually boils down to making sure you have the exact same environment variables in both places (and that you don't have a 32/64 mixup at any layer -- including VSCode itself or the shell you use). |
@fabioz Thank you for getting back to me on this topic. I had a look at the
Since FreeCAD depends on Qt5 I'm guessing that this is the part which breaks the import of FreeCAD in my script. Since I didn't change any settings or update anything between running your test script this change in |
The extension doesn't tweak path, and doesn't really know anything about PyQt. More likely, whatever installed Python into that particular directory, also added it to PATH. |
Why doesn't the PyQt directory show in |
Well, the path isn't really changed in From what's being said, this seems like a bugfix (the correct thing is probably having that added to the PATH) -- the fact that it doesn't work in this particular use-case appears to be because the separate Qt5 installations are incompatible (so, it's an installation issue on this particular machine, not a problem in general). |
One thing I thought about, if you're up to it is keeping the latest If you're up to it, the steps are:
Then, in your launch config add:
To check that it actually works, you can put the contents below at the top of your script and make sure it points to the version of the repo.
Then, you can check out a particular tag and see if the code works even with the latest Something as: git checkout v1.0.0b11 |
I updated
PyQt directory is listed in the
PyQt directory is not listed in the I then went back to version I had a look at the changes from version |
It might be indirectly related, yes! When this setting is "auto" (which is the default), pydevd tries to detect the correct PyQt version by import probing... and perhaps that breaks here because it finds a "wrong" version first? I'm not entirely sure why Anyway, can you try |
That's it. Adding |
I think this might be related to #362, somehow. It's still not clear to me as to why having that entry in PATH makes a difference, regardless of where it comes from, but we might have to reconsider the default in light of these side effects. |
Let me know if you want me to test anything else in this context. For now I added the option |
We'll track further investigation in #362. |
Import of FreeCAD failes after update to version 2020.6.91350.
Works with version 2020.6.90262.
Running the same code outside of VS Code also works.
Nothing else was changed/updated with the update of the python extension.
Environment data
python.languageServer
setting: MicrosoftExpected behaviour
Import module without error.
Actual behaviour
Module is not imported. Throws exception:
Steps to reproduce:
The following code throws the ImportError exception when extension version 2020.6.91350 is used.
Doesn't throw any exception when used with previous version 2020.6.90262
The text was updated successfully, but these errors were encountered: