簡體   English   中英

Pydev顯示了未解決的導入,但代碼有效

[英]Pydev shows Unresolved import but code works

我在Eclipse上使用Pydev。

這是我的代碼

import pandas as pd
from urllib.request import urlopen
from http.client import RemoteDisconnected

xl_sheet = pd.read_excel('sample.xlsx', sheet_name='Sheet1')
for i in xl_sheet.index:
    web_url = xl_sheet['Web'][i]

    if isinstance(web_url, str):
        if 'http://' not in web_url:
            web_url = 'http://' + web_url
        print(web_url)

        try:
            code = urlopen(web_url).getcode()
        except RemoteDisconnected:
            print('not working')

Pydev顯示了from http.client import RemoteDisconnected此行的unresolved import 但是,當我運行代碼時,它就可以工作(對於少數停機的站點,它not working打印)。 有什么事嗎

請嘗試將http.client添加到強制內置中,以查看它是否可以解決您的問題。

請參閱http://www.pydev.org/manual_101_interpreter.html#PyDevInterpreterConfiguration-ForcedBuiltins,以獲取有關如何實際執行操作(以及如何使用)的詳細信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM