Pandas import error when debugging using PVTS

♀尐吖头ヾ 提交于 2019-11-28 08:18:07

问题


I am dealing with a very silly error, and wondering if any of you have the same problem. When I try to import pandas using import pandas as pd I get an error in copy.py. I debugged into the pamdas imports, and I found that the copy error is thrown when pandas tries to import this:
from pandas.io.html import read_html
The exception that is throwns is:

un(shallow)copyable object of type <type 'Element'>

I do not get this error if I try to straight up run the code and not use the PVTS debugger. I am using the python 2.7 interpreter, pandas version 0.12 which came with the python xy 2.7.5.1 distro and MS Visual Studio 2012.

Any help would be appreciated. Thanks!


回答1:


This is a limitation of the way PTVS detects unhandled exceptions - it can't see the except-block that's going to catch this exception because it is in the code that is eval'd from a string. See the bug in the tracker for more details.

As a workaround, disable "Debug standard library" checked in Tools -> Options -> Python Tools -> Debugging - this should cause the exception to be ignored.




回答2:


I had the same problem for a while, disabling "Debug standard library" didn't help, then I downloaded the latest version of Python (3.4), pip installed the libs (for example NLTK), and it worked!




回答3:


I had a system crash while developing a PTVS app and then ran into this problem, re-running the Intellisense 'refresh DB' cleared it.




回答4:


I faced the same issue, but just hitting 'Continue' will cause it to be ignored and the code execution will proceed in the usual way. Or you could uncheck the "Break when this exception type is user-handled" option that comes up in the dialog box displaying the error.



来源:https://stackoverflow.com/questions/20532621/pandas-import-error-when-debugging-using-pvts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!