Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python/MVS - Standard library module invoked

I'm trying to run the following code on Microsoft Visual Studio (Python 3.6, 64-bit) and receive the error message that "Standard library module invoked user code during import; breakpoints disabled for invoked code"

I really hope you can help me. I have no experience in MVS. Thank you!!

Please find my code below:

Newton raphson method.
from __future__ import division
from unittest.test.test_result import __init__
import numpy as np
import matplotlib.pyplot as plt
from cplane_np import ArrayComplexPlane
from math import sqrt

####################################################################
class NewtonRaphson(ArrayComplexPlane):
"""define a class called NewtonRaphson which is a subclass from     
ArrayComplexPlane"""
def __init__(self):
    ArrayComplexPlane.__init__(self, -2, 2, 401, -2, 2, 401)
    self.z= ArrayComplexPlane(-2, 2, 401, -2, 2, 401).plane
    om=self.z
    om1= om.as_matrix()
    self.resu= self.meth2()
    ###Array of roots and iterations.

self.plo= self.plo_res()

def meth1(self,z0=3):


    x0=z0    #The initial value.
    n=0    # The initial value of iterations.
    dx=0.01
    dy=0.01
    eps=sqrt(dx**2+dy**2)

    while df(x0)!=0:    #the derivation of f(x) should be not equal to zero.

        n+=1
        #x1=self.apply(new_fun(x0))
        x1= new_fun(x0)
        if abs(x1-x0)< eps: #The condition to stop the iteration
            return (x1,n)
        else:
            x0=x1   #assign new value of x1 to x0

def meth2(self):
    ve= np.vectorize(self.meth1 )
    return ve(self.z)

def plo_res(self):
    res1=self.resu
    res_11= np.array(res1[0],dtype='float')
    plt.imshow(res_11)
    return plt.show()

Output

like image 976
DragonUS Avatar asked Mar 20 '26 20:03

DragonUS


1 Answers

For future reference: this is expected to be fixed in visual studio 2017 15.6

https://github.com/Microsoft/PTVS/issues/3408

To fix this before it gets out follow the suggestions as posted in the above github thread:

If you'd like to try it right now, you should be able to overwrite your copy of debugger.py with the latest version at https://github.com/Microsoft/PTVS/blob/master/Python/Product/PythonTools/ptvsd/debugger.py

(search for debugger.py under your microsoft visual studio install directory)

It's possible that these warnings may have been the cause of the "debugger operation in progress" or made it much worse.

like image 127
cageman Avatar answered Mar 22 '26 12:03

cageman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!