Skip to content
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

I found a question, please answer :) #1301

Closed
Purple-tulip opened this issue Mar 20, 2019 · 8 comments
Closed

I found a question, please answer :) #1301

Purple-tulip opened this issue Mar 20, 2019 · 8 comments

Comments

@Purple-tulip
Copy link

I want to use jedi's analysis function, but found the problem.
The next py file(test.py) needs to be analyzed:

import pandas as pd
def read():
data = pd.read_excel('C:\Users\DELL\Desktop\iexcel.xlsx',sheet_name='Sheet1')
print(data)

The analysis code I wrote is:
import jedi
script = jedi.Script(source=None, path='test.py')
errors = set(repr(e) for e in script._analysis())

The error message is : "Ran out of input"
i think the codes in test.py are correct, but i don't konw why the Analysis results will be given an error.
Please give me some advice, I don't know if this is the cause of my mistake······
thanks a lot 👍

@Purple-tulip
Copy link
Author

Forgot to replenish the operating environment, sorry······
jedi version '0.13.2'
python.exe 3.63
I use pycharm
win10
What do I need to add? If so, please let me know.

@Purple-tulip
Copy link
Author

I just upgraded the version of parso, it is now the latest version '0.3.4'
But the problem has not been solved.

I got a lot of specific error messages

File "C:\Users\DELL\AppData\Roaming\Python\Python36\site-packages\parso\cache.py", line 91, in load_module
module_cache_item = parser_cache[hashed_grammar][path]
KeyError: 'D:\work\data\plugin\Com.Isearch.Func.Python\lib\shlex.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:/work/src/python/src/ubpa/ijedi/re_study.py", line 169, in
errors = set(repr(e) for e in script.analysis())
File "D:\work\data\plugin\Com.Isearch.Func.Python\lib\site-packages\jedi\api_init
.py", line 369, in _analysis
types = context.eval_node(node)
············································
···············································
················································ (a lot of specific error messages)
·············································
··············································
···········································
File "D:\work\data\plugin\Com.Isearch.Func.Python\lib\site-packages\jedi\evaluate\dynamic.py", line 132, in search_function_executions
evaluator, [module_context], string_name):
File "D:\work\data\plugin\Com.Isearch.Func.Python\lib\site-packages\jedi\evaluate\imports.py", line 592, in get_modules_containing_name
m = check_fs(p)
File "D:\work\data\plugin\Com.Isearch.Func.Python\lib\site-packages\jedi\evaluate\imports.py", line 566, in check_fs
import_names=import_names,
File "D:\work\data\plugin\Com.Isearch.Func.Python\lib\site-packages\jedi\evaluate\imports.py", line 510, in load_module
cache_path=settings.cache_directory)
File "D:\work\data\plugin\Com.Isearch.Func.Python\lib\site-packages\jedi\evaluate_init
.py", line 391, in parse
return self.parse_and_get_code(*args, **kwargs)[0]
File "D:\work\data\plugin\Com.Isearch.Func.Python\lib\site-packages\jedi\evaluate_init
.py", line 388, in parse_and_get_code
return self.grammar.parse(code=code, path=path, **kwargs), code
File "C:\Users\DELL\AppData\Roaming\Python\Python36\site-packages\parso\grammar.py", line 76, in parse
return self._parse(code=code, **kwargs)
File "C:\Users\DELL\AppData\Roaming\Python\Python36\site-packages\parso\grammar.py", line 97, in _parse
module_node = load_module(self._hashed, path, cache_path=cache_path)
File "C:\Users\DELL\AppData\Roaming\Python\Python36\site-packages\parso\cache.py", line 95, in load_module
return _load_from_file_system(hashed_grammar, path, p_time, cache_path=cache_path)
File "C:\Users\DELL\AppData\Roaming\Python\Python36\site-packages\parso\cache.py", line 115, in _load_from_file_system
module_cache_item = pickle.load(f)
EOFError: Ran out of input

@Purple-tulip
Copy link
Author

Sorry, there is so much information, but I really hope someone can help me...
The first error is KeyError: 'D:\work\data\plugin\Com.Isearch.Func.Python\lib\shlex.py'

This file is real and I can open it...

@Purple-tulip
Copy link
Author

Is my understanding of jedi not enough? I really hope someone can help me...

@davidhalter
Copy link
Owner

Try to clear the Jedi/Parso cache. That might help. Otherwise, I wouldn't use the _analysis function, it's not maintained at the moment and there's a reason it's not public. I hope to make it work one day, but that is at least 3 years away. So not sure if that's ever going to happen.

@Purple-tulip
Copy link
Author

Thank you very much for your answer. ^_^

@Purple-tulip
Copy link
Author

I should have realized earlier that it is a non-public method······

@davidhalter
Copy link
Owner

I will close I guess. The first dependency for this would probably be #1059.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants