1
Vote

ipython w/o pylab issue

description

switched from ipython mode to ipython w/o pylab,

entered:
import matplotlib.path as mpath
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt


fig, ax = plt.subplots()

Path = mpath.Path
path_data = [
    (Path.MOVETO, (1.58, -2.57)),
    (Path.CURVE4, (0.35, -1.1)),
    (Path.CURVE4, (-1.75, 2.0)),
    (Path.CURVE4, (0.375, 2.0)),
    (Path.LINETO, (0.85, 1.15)),
    (Path.CURVE4, (2.2, 3.2)),
    (Path.CURVE4, (3, 0.05)),
    (Path.CURVE4, (2.0, -0.5)),
    (Path.CLOSEPOLY, (1.58, -2.57)),
    ]
codes, verts = zip(*path_data)
path = mpath.Path(verts, codes)
patch = mpatches.PathPatch(path, facecolor='r', alpha=0.5)
ax.add_patch(patch)

# plot control points and connecting lines
x, y = zip(*path.vertices)
line, = ax.plot(x, y, 'go-')

ax.grid()
ax.axis('equal')
then entered

plt.show(

and got the dump below.

note that if you paste the code above withe plt.show(), you get the pop out w the graph & all is well. however, if you do it up to the plt.show() line, and enter "plt.show(", you get the below trace or and repl exit.


<description>System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.PythonTools.Intellisense.SignatureHelpSource.AugmentSignatureHelpSession(ISignatureHelpSession session, IList1 signatures)
at Microsoft.VisualStudio.Language.Intellisense.Implementation.SignatureHelpSession.Recalculate()
at Microsoft.VisualStudio.Language.Intellisense.Implementation.SignatureHelpSession.Start()
at Microsoft.VisualStudio.Language.Intellisense.Implementation.SignatureHelpBroker.TriggerSignatureHelp(ITextView textView)
at Microsoft.PythonTools.Intellisense.IntellisenseController.TriggerSignatureHelp()
at Microsoft.PythonTools.Intellisense.IntellisenseController.OpenParenStartSignatureSession()
at Microsoft.PythonTools.Intellisense.IntellisenseController.HandleChar(Char ch)
at Microsoft.PythonTools.Intellisense.IntellisenseController.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
at Microsoft.VisualStudio.Repl.ReplWindow.PreLanguageCommandFilterExec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
at Microsoft.VisualStudio.Repl.ReplWindow.CommandFilter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.SendCommand(Guid cmdGroup, UInt32 cmdID, Object inParam)
at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.TextInput(TextCompositionEventArgs args)
at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.<DispatchTextInputEvents>b__0(KeyProcessor p, TextCompositionEventArgs args)
at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.<>c__DisplayClass1e
1.<Dispatch>b__1a()
at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)</description>
</entry>

comments

Zooba wrote Aug 13 at 11:10 PM

This is because the session may be dismissed while we are still augmenting the data, and we raise a NullReferenceException when we attempt to store the current best signature against the session object.

We should calculate the best signature once the session has been displayed rather than attempting to pass it back from the calculation stage.