簡體   English   中英

OSError: [WinError 123] 文件名、目錄名或卷標語法不正確(嘗試從驅動器訪問圖像數據集時出錯)

[英]OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect (error while trying to access an image dataset from drive)

我正在嘗試通過 jupyter notebook 中的以下代碼訪問保存在我的谷歌驅動器中的數據集(並計算圖像數量),但我不斷收到此錯誤。 出於安全原因,我無法使用 google colab。數據集有 17 個文件夾,每個文件夾中都有 200 多張圖像,因此我也無法下載。

代碼:

dataset='https://drive.google.com/drive/folders/16BXzy3nAGRJAH5j23Z38eG3npsSIqHEf?usp=sharing'

data_dir = pathlib.Path(dataset)

image_count = len(list(data_dir.glob('*/*.jpg')))

print(image_count)

錯誤:

OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'https:\\drive.google.com\\drive\\folders\\16BXzy3nAGRJAH5j23Z38eG3npsSIqHEf?usp=sharing'

看起來您正在嘗試使用 os 模塊連接遠程位置。 錯誤說 -

錯誤:OSError:[WinError 123] 文件名、目錄名或卷標語法不正確:

請嘗試使用 google API 代碼連接 Google Drive,並使用相應的端點調用操作。

API 代碼: https : //developers.google.com/drive/api/v3/quickstart/python

端點列表: https : //developers.google.com/resources/api-libraries/documentation/drive/v3/python/latest/drive_v3.files.html

暫無
暫無

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

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