代码之家  ›  专栏  ›  技术社区  ›  WDR

需要帮助查找Spyder IDE中的错误行吗

  •  0
  • WDR  · 技术社区  · 5 年前

    我使用Spyder IDE,但大多数时候我找不到容易发生错误的行。例如,这是其中一个错误:

    runfile('C:/Users/m/Desktop/python/third.py', wdir='C:/Users/m/Desktop/python')
    Traceback (most recent call last):
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3267, in run_code
        exec(code_obj, self.user_global_ns, self.user_ns)
    
      File "<ipython-input-1-22ecdcbaada4>", line 1, in <module>
        runfile('C:/Users/m/Desktop/python/third.py', wdir='C:/Users/m/Desktop/python')
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
        execfile(filename, namespace)
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
        exec(compile(f.read(), filename, 'exec'), namespace)
    
      File "C:/Users/m/Desktop/python/third.py", line 134
        predicted_stock_price = (predicted_stock_price + 1) *
                                                              ^
    SyntaxError: invalid syntax
    

    我如何理解是哪行代码导致了错误?为什么这个IDE不像其他IDE那样显示错误行?

    runfile('C:/Users/m/Desktop/python/third.py', wdir='C:/Users/m/Desktop/python')
    Using TensorFlow backend.
    Traceback (most recent call last):
    
      File "<ipython-input-18-22ecdcbaada4>", line 1, in <module>
        runfile('C:/Users/m/Desktop/python/third.py', wdir='C:/Users/m/Desktop/python')
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
        execfile(filename, namespace)
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
        exec(compile(f.read(), filename, 'exec'), namespace)
    
      File "C:/Users/m/Desktop/python/third.py", line 45, in <module>
        r = s.get('https://platform.tgju.org/fa/tvdata/history?symbol=AFGHAN_USD&resolution=60&from=1556027700&to=1561211760' , json = data ).json()
    
      File "C:\ProgramData\Anaconda3\lib\site-packages\requests\models.py", line 897, in json
        return complexjson.loads(self.text, **kwargs)
    
      File "C:\ProgramData\Anaconda3\lib\json\__init__.py", line 348, in loads
        return _default_decoder.decode(s)
    
      File "C:\ProgramData\Anaconda3\lib\json\decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    
      File "C:\ProgramData\Anaconda3\lib\json\decoder.py", line 355, in raw_decode
        raise JSONDecodeError("Expecting value", s, err.value) from None
    
    JSONDecodeError: Expecting value
    
    0 回复  |  直到 5 年前