microsoft / ptvs Goto Github PK
View Code? Open in Web Editor NEWPython Tools for Visual Studio
Home Page: https://aka.ms/PTVS
License: Apache License 2.0
Python Tools for Visual Studio
Home Page: https://aka.ms/PTVS
License: Apache License 2.0
I don't think the following issue is documented anywhere, but for some it may not be obvious.
In order to make Visual Studio PyTools IntelliSense work for a .pyd extension, it is required to select, in Project > Properties > General > Interpreter, Python interpreter matching target architecture of the .pyd binary.
Especially, if is relevant if both 32-bit and 64-bit Python installations are hosted side-by-side.
For instance, given side-by-side installation of the two Python interpreters:
C:\Python32 which is 64-bit version
C:\Python32x86-32 which is 32-bit version
if a .pyd is installed in C:\Python32 only, then one may need to choose "Python 64-bit 3.2" as the project interpreter.
Otherwise,
Currently with open(filename) as f
will auto-complete f
to filename
. As we're defining a new name here, we should not suggest anything.
class abc(object):
"""doc string"""
def init(self, value):
self.value = value
def x(self):
"""doc string"""
pass
Do refactor rename in either of the doc strings, a null reference exception is raised.
Instead we should give you the "Please select a symbol to be renamed." dialog
Pre-requisites:
You can repro this with any script. You can just have a one-line script with import sys
and put a breakpoint on the first line. By the time the breakpoint has hit, there are already hundreds of lines of exceptions in the output window, making it hard to get any useful information from the debug window if you are using OutputDebugString or otherwise trying to read the contents of the debug window.
Short sample output:
Short snippet:
exceptions.AttributeError
exceptions.TypeError
exceptions.AttributeError
exceptions.AttributeError
exceptions.AttributeError
exceptions.TypeError
exceptions.AttributeError
exceptions.AttributeError
exceptions.TypeError
exceptions.TypeError
exceptions.TypeError
exceptions.TypeError
exceptions.TypeError
exceptions.TypeError
exceptions.AttributeError
exceptions.AttributeError
'python_d.exe' (Python): Loaded 'D:\python_src\Python-2.7.8\lib\sysconfig.py'. Module was built without symbols.
exceptions.AttributeError
exceptions.TypeError
exceptions.TypeError
exceptions.TypeError
exceptions.AttributeError
'python_d.exe' (Python): Loaded 'D:\python_src\Python-2.7.8\lib\re.py'. Module was built without symbols.
'python_d.exe' (Python): Loaded 'D:\python_src\Python-2.7.8\lib\sre_compile.py'. Module was built without symbols.
'python_d.exe' (Python): Loaded 'D:\python_src\Python-2.7.8\lib\sre_parse.py'. Module was built without symbols.
'python_d.exe' (Python): Loaded 'D:\python_src\Python-2.7.8\lib\sre_constants.py'. Module was built without symbols.
Over the normal course of running my application, I counted that ~3,000 out of ~3,500 lines were just these exception messages. It would be nice if these could be silenced. If the issue is by design, then maybe there's a way to silence it only for exceptions that are thrown by the interpreter?
If you have a reference to a .pyd file from a Python project, its parent directory is included in the search path when you run/debug, but not when running tests.
(related to, but not the same as, https://pytools.codeplex.com/workitem/2934)
custom added envs have a Remove option under configure. auto detected ones dont. this seems inconsistent.
I have a mixed VS solution with three C# projects and one IronPython project in it. When I try to open this solution with the 13th April build of PTVS installed VS 2013 Desktop Express freezes with the notification "VS Express 2013 Desktop Express is busy ... waiting for an internal operation to complete ...". Solution Explorer shows that the Solution is "(loading...)" but there is little to no CPU activity. It looks like something is deadlocked.
I originally thought that this was due to some combination of editor windows being open but this seems to be not so. If I rename the solution folder then the project opens fine. Doing nothing further if I then immediately close it and reopen it then the hang occurs. Renaming the solution folder again repeats this behaviour, it opens once the first time and not thereafter.
The behaviour first occurred in the 6th April Dev Build, before then Dev Build 2015-03-26 seemed to work fine except for the occasional freeze that required a restart which all previous builds of PTVS seem to have suffered from when an IronPython project is loaded in VS but with the IronPython source not necessarily being loaded in the editor.
Type "a = b" and hit enter, and it will complete to an item. Now hit Ctrl+Z to undo and it doesn't.
Undoing should undo the completed part and leave what the user typed.
Move page from CodePlex to https://github.com/Microsoft/PTVS/wiki/Pyvot
I've tried all approaches I can think of - creating a new virtualenv from with in PTVS, using an existing virtualenn, recreated projects etc. No matter how I try the virtualenv seems to be ignored. Visual studio is showing my virtualenv by name active and all, but is actually listing global packages. And installing packages through PTVS also installs to global packages instead of the virtualenv.
Attaching screenshot to clarify.
I'm using Visual Studio 2013 community edition. PVTS 2.1 (also tried 2.2 beta). Python 2.7.9.
Using the latest dev version of PTVS, PyPy3 2.4 (32 bit), VS 2015 CTP, Windows 10 TP.
This is the traceback (http://i.imgur.com/X3qNp3F.png):
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.2\visualstudio_py_launcher.py", line 25, in
import visualstudio_py_debugger
File "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.2\visualstudio_py_debugger.py", line 65, in
import stackless
File "C:\PyPy3\lib_pypy\stackless.py", line 542, in
_init()
File "C:\PyPy3\lib_pypy\stackless.py", line 538, in _init
tasklet._init.func(_main_tasklet, label='main')
AttributeError: 'function' object has no attribute 'func'
Internal error detected. Please copy the above traceback and report at
http://go.microsoft.com/fwlink/?LinkId=293415
Press Enter to close. . .
When placing the mouse cursor over a variable in a python code window, Visual studio will "lock up" for 10 seconds to couple minutes.
This is only occurring in mixed mode debugging where I have an application that has loaded python33.dll. It works fine when not debugging. It also works fine for pure python coding using the .python exe.
I originally saw this problem with VS2012 where it would appear to hang (is it related to this ? https://pytools.codeplex.com/workitem/3015) Eventually, I figured out it was when I moved the cursor over text so suspected Intellisense.
I installed VS2013 and tired again. This time, the intellisense window would pop up but only after a very long delay. All other functions work fine. I can step though code, see variables in the watch windows, etc.
I don't have access to the core application importing python33.dll but can say it is python 3.3.2 64 bit. If there is another application out there that uses python33.dll, I could try that to determine if it is my setup our somehow related to my application (suggestions?)
I'm guessing this must have been tested so that there is some configuration out there that can make this work.
At the end of the wizard, your project will have been added to a new solution, not the original one.
Got a deadlock opening a file with VS 2015 with the following two stacks:
UI thread:
WindowsBase.dll!System.Windows.Threading.DispatcherSynchronizationContext.Wait(System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
mscorlib.dll!System.Threading.SynchronizationContext.InvokeWaitMethodHelper(System.Threading.SynchronizationContext syncContext, System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
[Native to Managed Transition]
mscorlib.dll!System.Lazy<Microsoft.PythonTools.Intellisense.CommentTaskProvider>.LazyInitValue()
mscorlib.dll!System.Lazy<Microsoft.PythonTools.Intellisense.CommentTaskProvider>.Value.get()
Microsoft.PythonTools.dll!Microsoft.PythonTools.Intellisense.VsProjectAnalyzer.ConnectErrorList(Microsoft.PythonTools.Analysis.IProjectEntry projEntry, Microsoft.VisualStudio.Text.ITextBuffer buffer)
Microsoft.PythonTools.dll!Microsoft.PythonTools.Intellisense.VsProjectAnalyzer.MonitorTextBuffer(Microsoft.VisualStudio.Text.Editor.ITextView textView, Microsoft.VisualStudio.Text.ITextBuffer buffer)
Microsoft.PythonTools.dll!Microsoft.PythonTools.Intellisense.IntellisenseControllerProvider.TryCreateIntellisenseController(Microsoft.VisualStudio.Text.Editor.ITextView textView, System.Collections.Generic.IList<Microsoft.VisualStudio.Text.ITextBuffer> subjectBuffers)
Microsoft.VisualStudio.Platform.VSEditor.dll!Microsoft.VisualStudio.Language.Intellisense.Implementation.IntellisenseManagerConnectionListener.SubjectBuffersConnected.AnonymousMethod__3(Microsoft.VisualStudio.Language.Intellisense.IIntellisenseControllerProvider provider)
Worker thread:
mscorlib.dll!System.Lazy<Microsoft.PythonTools.Intellisense.CommentTaskProvider>.LazyInitValue()
mscorlib.dll!System.Lazy<Microsoft.PythonTools.Intellisense.CommentTaskProvider>.Value.get()
Microsoft.PythonTools.dll!Microsoft.PythonTools.Intellisense.VsProjectAnalyzer.UpdateErrorsAndWarnings(Microsoft.PythonTools.Analysis.IProjectEntry entry, Microsoft.VisualStudio.Text.ITextSnapshot snapshot, Microsoft.PythonTools.Parsing.CollectingErrorSink errorSink, System.Collections.Generic.List<Microsoft.PythonTools.Intellisense.TaskProviderItem> commentTasks)
Microsoft.PythonTools.dll!Microsoft.PythonTools.Intellisense.VsProjectAnalyzer.ParseFile(Microsoft.PythonTools.Analysis.IProjectEntry entry, string filename, System.IO.Stream content, Microsoft.PythonTools.Parsing.Severity indentationSeverity)
Microsoft.PythonTools.dll!Microsoft.PythonTools.Intellisense.ParseQueue.EnqueueFile.AnonymousMethod__0()
Microsoft.PythonTools.dll!Microsoft.PythonTools.Intellisense.ParseQueue.EnqueWorker.AnonymousMethod__0(object dummy)
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(object state)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Carrying on from this issue on codeplex:
https://pytools.codeplex.com/workitem/3017
I had a wealth of information to provide to back up what I was saying, unfortunately codeplex decided to take all comments and discussions offline right around that time, and I never got around to posting them when it came back online (if it is back online).
The gist of what I was getting at with regards to the issue was that it was taking upwards of 30 minutes for the code completion database to finish on a system that is capable of 2000MB/s data transfers, with 12 cores (24 with hyperthreading) and 64GB of RAM to analyze the data with (hint: it's the same time even on a slow system, it seems). The end result was that it mostly provided the same method signatures and auto-completion as PyCharm was able to glean in 2-3 minutes of analysis, except that often times the PTVS data was truncated in the display (and PyCharm was not).
Meanwhile, in an IPython session I am able to get more complete method signatures (many of which neither PTVS or PyCharm appear to pick up), and help easily available through either the console or a notebook - so the data is certainly there, it's just not being analyzed, and what is being analyzed is taking too long (especially when regular virtualenv creation is taken into consideration) and being underutilized (truncated).
PTVS Dev 2015-04-06 VS 2013
(this doesn't happen consistently)
Create new bottle project (starter project with bootstrap)
Click OK to create virtual env and dependencies
Result:
System.InvalidOperationException was unhandled
Message: An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll
Additional information: Collection was modified; enumeration operation may not execute.
With call stack:
mscorlib.dll!System.ThrowHelper.ThrowInvalidOperationException(System.ExceptionResource resource) Unknown
mscorlib.dll!System.Collections.Generic.Dictionary<System.__Canon,System.__Canon>.ValueCollection.Enumerator.MoveNext() Unknown
> Microsoft.PythonTools.Analysis.dll!Microsoft.PythonTools.Analysis.ProjectEntry.Parse(bool enqueueOnly, System.Threading.CancellationToken cancel) Unknown
Microsoft.PythonTools.Analysis.dll!Microsoft.PythonTools.Analysis.ProjectEntry.Analyze(System.Threading.CancellationToken cancel, bool enqueueOnly) Unknown
Microsoft.PythonTools.dll!Microsoft.PythonTools.Intellisense.AnalysisQueue.Worker(object threadStarted) Unknown
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj) Unknown
I have a dump file, I can upload it to our share when I'm back at the office, if that helps.
I am using Visual Studio 2015 CTP with PTVS 2.2 Beta, PyPy3 2.4.
Going to Python Environments and calling the pypy interpreter crashes VS.
I develop an extension module that needs to work with both x86 and x64 interpreters. These are output by my build system to different build trees, and I need my Python project which uses the extension module to be able to find the correct extension module. I have added both Debug x64 and Debug x86 environments, and I can select the correct environment, but there is no way to have the search path be updated accordingly so that when the x64 environment is selected, it uses the search path to locate the x64 extension module, and similarly for x86.
It seems like this should ultimately play nicely with the Visual Studio solution / project configuration system. This way, both the python environment as well as the search paths could be tied to a particular Project configuration, and the solution configuration could select various project configurations accordingly. It seems like interoperability with the Visual Studio project / solution configuration system is unimplemented.
Hi
I tryed the 2.2 Beta and it slows the IDE sown so every key stroke needs 1-2sec to display on the screen...
Changed back to 2.1 for now.
When dragging the window from a vertical layout to a horizontal layout it doesn't switch to the horizontal layout.
It looks like PyPy's virtual environments use a bin
folder rather than Scripts
, and so we don't integrate properly in the UI.
there is an option under tools, options, text editor, python, advanced called "add new line on enter at end of fully typed word". can we have this apply to interpreters too?
Create Django Project (bootstrap starter template)
Run one of the 3 tests
Result: test failure
I'm using Django 1.8
Test Name: test_about
Test Outcome: Failed
Result StandardError:
======================================================================
ERROR: tearDownClass (app.tests.ViewTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\huvalo\AppData\Local\Continuum\Anaconda3\lib\site-packages\django\test\testcases.py", line 962, in tearDownClass
cls._rollback_atomics(cls.cls_atomics)
AttributeError: type object 'ViewTest' has no attribute 'cls_atomics'
----------------------------------------------------------------------
Ran 1 test in 0.516s
FAILED (errors=1)
VS 2015 22823.1 D14REL Enterprise (xlab image)
PTVS 30423.00
Create IronPython WPF app
Double click on .xaml file to open in editor
I get the split view of designer/xaml code but the designer part at the top has a progress bar that never ends.
I don't know if it's that same design host dll issue we've had in the past.
In
def f(t : str = str):
pass
The second str
is highlighted as a type but the first str
is not.
If the engine attaches while getting a breakpoint hit count, we will deadlock.
Location of lock on UI thread:
int IDebugBoundBreakpoint2.GetHitCount(out uint pdwHitCount) {
pdwHitCount = (uint)_breakpoint.GetHitCountAsync().GetAwaiter().GetResult();
return VSConstants.S_OK;
}
Stack trace of the worker thread causing the lock:
Microsoft.PythonTools.dll!Microsoft.VisualStudioTools.UIThread.Invoke(System.Action action) Line 66 C#
Microsoft.PythonTools.dll!Microsoft.PythonTools.Repl.BasePythonReplEvaluator.EnsureConnected() Line 127 C#
Microsoft.PythonTools.dll!Microsoft.PythonTools.Repl.PythonDebugProcessReplEvaluator.PythonDebugProcessReplEvaluator(System.IServiceProvider serviceProvider, Microsoft.PythonTools.Debugger.PythonProcess process, Microsoft.PythonTools.PythonToolsService pyService, Microsoft.PythonTools.Debugger.IThreadIdMapper threadIdMapper) Line 534 C#
Microsoft.PythonTools.dll!Microsoft.PythonTools.Repl.PythonDebugReplEvaluator.AttachProcess(Microsoft.PythonTools.Debugger.PythonProcess process, Microsoft.PythonTools.Debugger.IThreadIdMapper threadIdMapper) Line 460 C#
Microsoft.PythonTools.dll!Microsoft.PythonTools.Repl.PythonDebugReplEvaluator.OnEngineAttached(object sender, Microsoft.PythonTools.Debugger.DebugEngine.AD7EngineEventArgs e) Line 430 C#
Microsoft.PythonTools.Debugger.dll!Microsoft.PythonTools.Debugger.DebugEngine.AD7Engine.SendLoadComplete(Microsoft.PythonTools.Debugger.DebugEngine.AD7Thread thread) Line 372 C#
Microsoft.PythonTools.Debugger.dll!Microsoft.PythonTools.Debugger.DebugEngine.AD7Engine.OnProcessLoaded(object sender, Microsoft.PythonTools.Debugger.ThreadEventArgs e) Line 1262 C#
Microsoft.PythonTools.Debugger.dll!Microsoft.PythonTools.Debugger.PythonProcess.HandleProcessLoad(System.IO.Stream stream) Line 796 C#
Microsoft.PythonTools.Debugger.dll!Microsoft.PythonTools.Debugger.PythonProcess.DebugEventThread() Line 448 C#
It looks like we need to marshal the LoadComplete event back to the UI thread sooner without blocking.
Got the following exception while analysing test.support.init.py:1472 from CPython 3.5. Can't see any obvious way to fix it other than checking _type
for null. The null is apparently coming from the days
property in datetime.py:474, which apparently has not assigned a type.
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
Stack:
at Microsoft.PythonTools.Analysis.Values.BuiltinNamespace`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetMember(Microsoft.PythonTools.Parsing.Ast.Node, Microsoft.PythonTools.Analysis.AnalysisUnit, System.String)
at Microsoft.PythonTools.Analysis.AnalysisSetExtensions.GetMember(Microsoft.PythonTools.Analysis.IAnalysisSet, Microsoft.PythonTools.Parsing.Ast.Node, Microsoft.PythonTools.Analysis.AnalysisUnit, System.String)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateMember(Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator, Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateBinary(Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator, Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateParenthesis(Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator, Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateAnd(Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator, Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateOr(Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator, Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateParenthesis(Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator, Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Microsoft.PythonTools.Parsing.Ast.Node)
at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(Microsoft.PythonTools.Parsing.Ast.IfStatement)
at Microsoft.PythonTools.Parsing.Ast.IfStatement.Walk(Microsoft.PythonTools.Parsing.Ast.PythonWalker)
at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(Microsoft.PythonTools.Parsing.Ast.SuiteStatement)
at Microsoft.PythonTools.Parsing.Ast.SuiteStatement.Walk(Microsoft.PythonTools.Parsing.Ast.PythonWalker)
at Microsoft.PythonTools.Analysis.Analyzer.FunctionAnalysisUnit.AnalyzeWorker(Microsoft.PythonTools.Analysis.Analyzer.DDG, System.Threading.CancellationToken)
at Microsoft.PythonTools.Analysis.Analyzer.DDG.Analyze(Microsoft.PythonTools.Analysis.Deque`1<Microsoft.PythonTools.Analysis.AnalysisUnit>, System.Threading.CancellationToken, System.Action`1<Int32>, Int32)
at Microsoft.PythonTools.Analysis.PythonAnalyzer.AnalyzeQueuedEntries(System.Threading.CancellationToken)
at Microsoft.PythonTools.Intellisense.AnalysisQueue+GroupAnalysis.Analyze(System.Threading.CancellationToken)
at Microsoft.PythonTools.Intellisense.AnalysisQueue.Worker(System.Object)
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart(System.Object)
Adding a new function snippet adds
def function(args):
pass
We let you tab over the name and args to replace them. We should also let you tab over pass.
Snippets are hardcoded to do 4 spaces of indention. That may not match the user settings. Instead we should use a tab and let editor settings replace those tabs with proper number of spaces.
When rebuilding the Intellisense DB I get an OutOfMemoryException:
2015-04-23T12:43:12: Starting analysis of 270 modules
2015-04-23T12:46:51: [ERROR] Analysis failed
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Collections.Generic.HashSet`1.Initialize(Int32 capacity)
at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value)
at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
at Microsoft.PythonTools.Analysis.VariableDef.EstimateTypeCount(IAnalysisSet extraTypes)
at Microsoft.PythonTools.Analysis.Values.IterableInfo.AddTypes(AnalysisUnit unit, IAnalysisSet[] types)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.MakeSequence(ExpressionEvaluator ee, Node node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateSequence(ExpressionEvaluator ee, Node node)
at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Node node)
at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(AssignmentStatement node)
at Microsoft.PythonTools.Parsing.Ast.AssignmentStatement.Walk(PythonWalker walker)
at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(SuiteStatement node)
at Microsoft.PythonTools.Parsing.Ast.SuiteStatement.Walk(PythonWalker walker)
at Microsoft.PythonTools.Analysis.Analyzer.FunctionAnalysisUnit.AnalyzeWorker(DDG ddg, CancellationToken cancel)
at Microsoft.PythonTools.Analysis.Analyzer.DDG.Analyze(Deque`1 queue, CancellationToken cancel, Action`1 reportQueueSize, Int32 reportQueueInterval)
at Microsoft.PythonTools.Analysis.PythonAnalyzer.AnalyzeQueuedEntries(CancellationToken cancel)
at Microsoft.PythonTools.Analysis.PyLibAnalyzer.Analyze()
at Microsoft.PythonTools.Analysis.PyLibAnalyzer.<Run>d__30.MoveNext()
My development machine has a total of 16 GB memory and there is still ~50% left when the process crashes with a usage of about ~1.7 GB.
Is there anything I can do so that PythonTools uses more memory?
VS 2015 22822.1 D14REL
PTVS 2.2 CL1457733_VS2015_22820
Create python app
Add item, unit test
def test_A(self):
a = 0
b = 10
pass
Put a breakpoint on a = 0
.
Debug test
Occasionally, I get this access violation exception (debugger breaks).
But most of the time, it runs without debugging. You don't see the "2nd attach" happening at all. This is worse than with CTP 6 where it would sometimes work as expected (debug and stop at that breakpoint), sometimes get the access violation.
I tried C# and C++ (native) unit test debugging, and haven't had seen any issue yet.
System.AccessViolationException was unhandled
Message: An unhandled exception of type 'System.AccessViolationException' occurred in System.ServiceModel.dll
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Thank you for PTVS.
I would like to request that PTVS move/rename the corresponding *.pyc file at the same time when moving/renaming the *.py file.
For example, given the following project structure:
package1
__init__.py
A.py
package2
__init__.py
testPackage
__init__.py
testA.py
testA.py:
import unittest
from package1.A import A
class TestRoutes(unittest.TestCase):
def testA(self):
A = A()
print A.Name
if __name__ == '__main__':
unittest.main()
And then if I move A.py to package2, but don't update the from/import statement, and run the test, I expect the test run to fail with an error like "ImportError: No module named A".
However, it succeeds without error (unexpectedly)!
Even cleaning the solution does not resolve the issue because the *.pyc doesn't get deleted during a clean.
Thank you.
"You need to implement IDkmLanguageInstructionDecoder for the Python language and return a reasonable string in GetMethodName(). The debugger will call GetMethodName() for each Python function that has a breakpoint in it. The result of GetMethodName() will get displayed to the user in the function column (it may be hidden by default) of the breakpoints window."
I have a mixed solution with three C# projects and one IronPython project in it. When I try to open this solution with the 6th April build of PTVS installed, VS 2013 Desktop Express freezes with the notification "VS Express 2013 Desktop Express is busy ... waiting for an internal operation to complete ...". Solution Explorer shows that the Solution is "(loading...)" but there is little to no CPU activity. It looks like something is deadlocked.
The previous Dev Build 2015-03-26 seemed to work fine except for the occasional freeze that required a restart which all previous builds of PTVS seem to have suffered from when an IronPython project is loaded in VS but with the IronPython source not necessarily being loaded in the editor.
When expanding [Python View] nodes in debugger, there are no children, and in debug builds there's an assertion failure:
GetChildren called on an unsupported DkmEvaluationResult.
at Microsoft.PythonTools.DkmDebugger.ExpressionEvaluator.GetChildren(DkmEvaluationResult result, DkmWorkList workList, Int32 initialRequestSize, DkmInspectionContext inspectionContext, DkmCompletionRoutine1 completionRoutine) in C:\TFS\xTVS\Python_Main\Python\Product\Debugger\DkmDebugger\ExpressionEvaluator.cs:line 516 at Microsoft.PythonTools.DkmDebugger.LocalComponent.Microsoft.VisualStudio.Debugger.ComponentInterfaces.IDkmLanguageExpressionEvaluator.GetChildren(DkmEvaluationResult result, DkmWorkList workList, Int32 initialRequestSize, DkmInspectionContext inspectionContext, DkmCompletionRoutine
1 completionRoutine) in C:\TFS\xTVS\Python_Main\Python\Product\Debugger\DkmDebugger\LocalComponent.cs:line 423
at Microsoft.VisualStudio.Debugger.EntryPoint.IDkmLanguageExpressionEvaluator_GetChildren(IntPtr pvClassInfo, IntPtr Result, IntPtr WorkList, Int32 InitialRequestSize, IntPtr InspectionContext, IntPtr CompletionRoutine)
When remotely attached to an Azure website, hitting a breakpoint causes debugger to enter the break mode, but there's nothing in call stack or locals, and the editor says "Code not running".
Pre-requisites:
Repro script:
import sys
sys.path.insert("d:\\src") # Step over this line
sys.path.insert("d:\\python_src")
When you step over this line, the first time nothing happens. The second time, I end up in the C implementation of PyMain -- in native code. I've seen double stepping in other instances as well where the second step actually succeeds and ends up on the next line of python code, but I can't find a reliable repro for that, so I'm not sure what triggers it to succeed on the second step sometimes vs. ending up in the implementation of Python on the second step other times.
Pre-requisites:
Repro script
import os
foo = os.path.join("foo", "bar") # (1) Step over this line
def some_func():
foo = os.path.join("foo", "bar") # (2) Step over this line
some_func()
Stepping over (1) works, but stepping over (2) ends up inside the middle of os.path.join()
inside of ntpath.py.
import os
path = os.path.join("foo", "bar")
path = os.path.join("bar", "baz")
if path: # (1) Set breakpoint here.
path = os.path.join("baz", "boo") # While stopped at (1), right click this line and choose Set Next Statement
pass
When you choose Set Next Statement, a dialog pops up saying this is unimplemented.
Would be nice to have a right click context menu that lists what's in the drop down. Makes it easier to discover "remove".
This is the same as issue # 1969 on the CodePlex issue tracker. https://pytools.codeplex.com/workitem/1969
It has been marked as resolved there, but I still see the problem with the latest stable release 2.1 and the latest dev build April 13th.
If a Python unittest has a decorator, it does not appear in the test explorer. If the decorator is removed, it then appears.
@patch.object(os.path, 'isfile')
def test_A(self):
''' Doesn't appear in the test explorer '''
self.fail("Not implemented")
def test_B(self):
''' This does appear in the test explorer '''
self.fail("Not implemented")
I'm using the mock library, so have hundreds of tests with patch decorators.
Using "Start without debugging" the following code executes without problems, but when running with debugging the program breaks with a "No module named invalidImport" error. It presents the options "Break" or "Continue" as for all non-recoverable errors. If I choose "Continue" the program continues without any issue.
The debugger somehow seems to ignore the try ... except ...
statement in the context manager while python correctly catches the error.
Clearly PTVS debugging thus should not break here.
from contextlib import contextmanager
@contextmanager
def ignoring(*exceptions):
try:
yield
except exceptions:
pass
with ignoring(ImportError):
import invalidImport
print "Test"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.