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
{{ message }}
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Technically file names are module names and names like 1.py or a-b.py are unimportable. Currently we fail with Unable to find document message which is not informative.
Options:
Give informative warning message (or make it error and then fail).
I'm not sure they're completely identical; I could have a file in some directory called a.py and my-script.py next to it which does from .a import foo and execute the latter just fine, right? The difference I'm seeing is that I think the assumption we'd make for #597 is to pretend untitled files are at the root, but I don't think that's so for the my-script.py case. I'd need to test and see what'd happen; this is just my initial thought.
Yes, I did some testing and things do seem to break. Though it looks like you can actually do python -m my-script and it works. My choice in using a relative import was probably a bad one; so I tested using absolute which also failed. Maybe it won't matter all that much, I was just worried about removing potentially important info about where a file exists.
For completion's sake, if you're curious:
% ~/weird2 tree
.
├── a│ ├── __init__.py
│ ├── __init__.pyc
│ └── b
│ ├── __init__.py
│ ├── __init__.pyc
│ └── c
│ ├── __init__.py
│ ├── __init__.pyc
│ └── __pycache__
│ └── __init__.cpython-37.pyc
├── runme.py
└── scripts
├── __pycache__
│ └── my-script.cpython-37.pyc
└── my-script.py
6 directories, 10 files
% ~/weird2 python scripts/my-script.py
Traceback (most recent call last):
File "scripts/my-script.py", line 1, in <module>
from a.b.c import foo
ImportError: No module named a.b.c
% ~/weird2 python -m scripts.my-script
/usr/local/opt/python@2/bin/python2.7: No module named scripts
% ~/weird2 python3 scripts/my-script.py
Traceback (most recent call last):
File "scripts/my-script.py", line 1, in <module>
from a.b.c import foo
ModuleNotFoundError: No module named 'a'
% ~/weird2 python3 -m scripts.my-script
hi from a.b.c.foo()!
Files that start with [0-9] also don't seem to be working..Keep getting the following prints: [Error - 2:08:08 PM] Unable to find document file:///c:/Users/../../08_HMI/08_011_HMI.py
Unfortunately I am still getting errors Unable to find document file
[Info - 1:36:02 PM] Analysis cache path: C:\Users\Ondrej Kyjanek\AppData\Local\Microsoft\Python Language Server
[Info - 1:36:02 PM] Microsoft Python Language Server version 0.5.51.0
[Info - 1:36:02 PM] Workspace root: c:\Dropbox\06_Repos\0_TESTS\mqttPahoTest
[Info - 1:36:03 PM] GetCurrentSearchPaths C:\Anaconda3\python36.exe
[Info - 1:36:03 PM] Interpreter search paths:
[Info - 1:36:03 PM] c:\anaconda3\dlls
[Info - 1:36:03 PM] c:\anaconda3\lib
[Info - 1:36:03 PM] C:\Anaconda3\Lib\site-packages
[Info - 1:36:03 PM] C:\Anaconda3
[Info - 1:36:03 PM] c:\users\ondrej kyjanek\appdata\roaming\python\python36\site-packages
[Info - 1:36:03 PM] c:\anaconda3\lib\site-packages\sphinx-1.5.1-py3.6.egg
[Info - 1:36:03 PM] c:\anaconda3\lib\site-packages\win32
[Info - 1:36:03 PM] c:\anaconda3\lib\site-packages\win32\lib
[Info - 1:36:03 PM] c:\anaconda3\lib\site-packages\pythonwin
[Info - 1:36:03 PM] c:\anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg
[Info - 1:36:03 PM] User search paths:
2020-08-21 12:36:04.4069127 [W:onnxruntime:, graph.cc:814 onnxruntime::Graph::Graph] Initializer embeddings_matrix:0_quantized appears in graph inputs and will not be treated as constant value/weight. This may fail some of the graph optimizations, like const folding. Move it out of graph inputs if there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2020-08-21 12:36:04.4075653 [W:onnxruntime:, graph.cc:814 onnxruntime::Graph::Graph] Initializer embeddings_matrix:0_scale appears in graph inputs and will not be treated as constant value/weight. This may fail some of the graph optimizations, like const folding. Move it out of graph inputs if there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2020-08-21 12:36:04.4075926 [W:onnxruntime:, graph.cc:814 onnxruntime::Graph::Graph] Initializer embeddings_matrix:0_zero_point appears in graph inputs and will not be treated as constant value/weight. This may fail some of the graph optimizations, like const folding. Move it out of graph inputs if there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2020-08-21 12:36:04.4076159 [W:onnxruntime:, graph.cc:814 onnxruntime::Graph::Graph] Initializer fixed_quantization_range_uint8 appears in graph inputs and will not be treated as constant value/weight. This may fail some of the graph optimizations, like const folding. Move it out of graph inputs if there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2020-08-21 12:36:04.4076395 [W:onnxruntime:, graph.cc:814 onnxruntime::Graph::Graph] Initializer fixed_zero appears in graph inputs and will not be treated as constant value/weight. This may fail some of the graph optimizations, like const folding. Move it out of graph inputs if there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
[Error - 1:36:15 PM] Request textDocument/documentSymbol failed.
Message: Object reference not set to an instance of an object.
Code: -32000
at Microsoft.Python.LanguageServer.Implementation.Server.HierarchicalDocumentSymbol(DocumentSymbolParams params, CancellationToken cancellationToken) in E:\A_work\3\s\src\LanguageServer\Impl\Implementation\Server.Symbols.cs:line 37
at Microsoft.Python.LanguageServer.Implementation.LanguageServer.DocumentSymbol(JToken token, CancellationToken cancellationToken) in E:\A_work\3\s\src\LanguageServer\Impl\LanguageServer.cs:line 229
[Error - 1:36:15 PM] Unable to find document file:///c:/Dropbox/06_Repos/0_TESTS/mqttPahoTest/test.py
Activity
AlexanderSher commentedon Mar 12, 2019
It is actually one fix for this one and #597: file that has name that can't be a module can have name and be analyzed (including absolute imports).
jakebailey commentedon Mar 12, 2019
I'm not sure they're completely identical; I could have a file in some directory called
a.pyandmy-script.pynext to it which doesfrom .a import fooand execute the latter just fine, right? The difference I'm seeing is that I think the assumption we'd make for #597 is to pretend untitled files are at the root, but I don't think that's so for themy-script.pycase. I'd need to test and see what'd happen; this is just my initial thought.AlexanderSher commentedon Mar 12, 2019
If you do
python my-script.py, you'll get an error:jakebailey commentedon Mar 12, 2019
Yes, I did some testing and things do seem to break. Though it looks like you can actually do
python -m my-scriptand it works. My choice in using a relative import was probably a bad one; so I tested using absolute which also failed. Maybe it won't matter all that much, I was just worried about removing potentially important info about where a file exists.For completion's sake, if you're curious:
jakebailey commentedon Mar 18, 2019
#778 too: We should be handling files without
.pyat the end in a similar fashion.tmab2003 commentedon Mar 21, 2019
Files that start with [0-9] also don't seem to be working..Keep getting the following prints:
[Error - 2:08:08 PM] Unable to find document file:///c:/Users/../../08_HMI/08_011_HMI.pykyjanond commentedon Aug 21, 2020
Unfortunately I am still getting errors
Unable to find document fileAny suggestions?
AngelontheRoad commentedon Sep 2, 2020
I got the same problem
Unable to find document file:///d:/A_Items/NP/np.pykushaldas commentedon Nov 20, 2020
I am having same problem on a Linux box:
kushaldas commentedon Nov 20, 2020
Upgrading to latest stable solved the issue.