question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Analysis engine terminates with "no iterator type for"

See original GitHub issue

Environment data

  • VS Code version: 1.25.0-insider
  • Extension version (available under the Extensions sidebar): current nightly
  • OS and version: macOS
  • Python version: 2.7.15 (see comment below)
  • Type of virtual environment used: direnv layout python (virtualenv)
  • Relevant/affected Python packages and their versions: N/A

Actual behavior

The extension terminates right after starting. Unfortunately I can’t share the source as it’s covered by an NDA.

I’m using the current master of PTVS to test (7eab53bf9f0fd9fd01e366dcf8ede77e738a003e).

Expected behavior

Analysis engine works.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

[Info  - 12:20:19] Created Microsoft.PythonTools.Interpreter.Ast.AstPythonInterpreter instance from Microsoft.PythonTools.Interpreter.Ast.AstPythonInterpreterFactory
Initializing for /Users/patrys/GitHub/redacted/redacted/.direnv/python-2.7.15/bin/python
Loading files from /Users/patrys/GitHub/redacted/redacted
Assertion Failed
No iterator type for Microsoft.PythonTools.Interpreter.Ast.AstPythonType (list::Type

   at Microsoft.PythonTools.Analysis.Values.BaseIteratorValue.GetIteratorTypeFromType(BuiltinClassInfo klass, AnalysisUnit unit) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Values/IteratorInfo.cs:line 62
   at Microsoft.PythonTools.Analysis.Values.IterableValue.MakeIteratorInfo(Node n, AnalysisUnit unit) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Values/IterableInfo.cs:line 159
   at Microsoft.PythonTools.Analysis.Values.BaseIterableValue.<>c__DisplayClass12_0.<IterableIter>b__0(Node n) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Values/IterableInfo.cs:line 78
   at Microsoft.PythonTools.Analysis.Analyzer.InterpreterScope.GetOrMakeNodeValue(Node node, NodeValueKind kind, Func`2 maker) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Analyzer/InterpreterScope.cs:line 379
   at Microsoft.PythonTools.Analysis.Values.BaseIterableValue.IterableIter(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Values/IterableInfo.cs:line 75
   at Microsoft.PythonTools.Analysis.Values.SpecializedCallable.Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Values/SpecializedCallable.cs:line 49
   at Microsoft.PythonTools.Analysis.AnalysisValueSetExtensions.Call(IAnalysisSet self, Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/AnalysisValueSetExtensions.cs:line 79
   at Microsoft.PythonTools.Analysis.AnalysisValue.GetIterator(Node node, AnalysisUnit unit) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/AnalysisValue.cs:line 272
   at Microsoft.PythonTools.Analysis.AnalysisValueSetExtensions.GetIterator(IAnalysisSet self, Node node, AnalysisUnit unit) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/AnalysisValueSetExtensions.cs:line 96
   at Microsoft.PythonTools.Analysis.PythonAnalyzer.SpecialIter(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/PythonAnalyzer.Specializations.cs:line 380
   at Microsoft.PythonTools.Analysis.Values.SpecializedCallable.Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Values/SpecializedCallable.cs:line 49
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateCall(ExpressionEvaluator ee, Node node) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Analyzer/ExpressionEvaluator.cs:line 388
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Node node) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Analyzer/ExpressionEvaluator.cs:line 220
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.Evaluate(Expression node) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Analyzer/ExpressionEvaluator.cs:line 56
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(ReturnStatement node) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Analyzer/DDG.cs:line 529
   at Microsoft.PythonTools.Parsing.Ast.ReturnStatement.Walk(PythonWalker walker) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Parsing/Ast/ReturnStatement.cs:line 32
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(SuiteStatement node) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Analyzer/DDG.cs:line 597
   at Microsoft.PythonTools.Parsing.Ast.SuiteStatement.Walk(PythonWalker walker) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Parsing/Ast/SuiteStatement.cs:line 34
   at Microsoft.PythonTools.Analysis.Analyzer.FunctionAnalysisUnit.AnalyzeWorker(DDG ddg, CancellationToken cancel) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Analyzer/FunctionAnalysisUnit.cs:line 89
   at Microsoft.PythonTools.Analysis.AnalysisUnit.Analyze(DDG ddg, CancellationToken cancel) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/AnalysisUnit.cs:line 152
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Analyze(Deque`1 queue, CancellationToken cancel, Action`1 reportQueueSize, Int32 reportQueueInterval) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Analyzer/DDG.cs:line 75
   at Microsoft.PythonTools.Analysis.PythonAnalyzer.AnalyzeQueuedEntries(CancellationToken cancel) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/PythonAnalyzer.cs:line 946
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.GroupAnalysis.Analyze(CancellationToken cancel) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Intellisense/AnalysisQueue.cs:line 290
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.Worker(Object threadStarted) in /Users/patrys/GitHub/Microsoft/ptvs/Python/Product/Analysis/Intellisense/AnalysisQueue.cs:line 235
   at System.Threading.Thread.ThreadMain_ParameterizedThreadStart(Object parameter)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
[Info  - 12:20:35] Connection to server got closed. Server will restart.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

The Python Tools server crashed 5 times in the last 3 minutes. The server will not be restarted.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
patryscommented, Jun 19, 2018

I’ve deleted the entire directory, I am no longer getting the error. Current state is https://github.com/Microsoft/vscode-python/issues/1393#issuecomment-397996312

0reactions
DonJayamannecommented, Jun 19, 2018

@patrys As the reported problem no longer persists, I’m closing this issue. Please feel free to reopen this issue if it persists.

Read more comments on GitHub >

github_iconTop Results From Across the Web

exceptions + signaling end-of-iterator: why is it bad in Java ...
Raised by an iterator's next() method to signal that there are no further values. This is derived from Exception rather than StandardError, ...
Read more >
4. Iterators and Generators - Python Cookbook, 3rd ... - O'Reilly
Once a generator function returns, iteration stops. However, the for statement that's usually used to iterate takes care of these details, so you...
Read more >
Failed precondition: Python interpreter state is not initialized ...
Error occurred when finalizing GeneratorDataset iterator: Failed precondition: Python interpreter state is not initialized. The process may be terminated.
Read more >
Everything You Need to Learn About Iterator in Python
An iterator is an object used for looping iterable objects like lists, tuples, dicts, and sets. Learn all about iterators in python.
Read more >
Python __iter__() and __next__() | Converting an object ...
The __iter__() function returns an iterator for the given object (array, set, tuple, etc. or custom objects). It creates an object that can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found