python讀取已存在檔案報錯windowserror:[error 3]
怨念太深。。開始讀取檔案程式碼為:
import pandas as pd Input=pd.read_csv(excelPath, index_col=0,encoding='utf-8',low_memory=False)報錯:
IOError: File C:\Users\Administrator\Desktop\Course comments\\\xe6\xb1\x87\xe5\x90\x88
但其實是存在的。。。
後來在網上找了一個方法,連結在此,照著修改了開啟檔案的方式
import pandas as pd import os pwd = os.getcwd() #獲得當前工作目錄還是報錯:os.chdir(os.path.dirname(excelPath))#改變工作目錄到dirname Input = pd.read_csv(os.path.basename(excelPath))#返回檔名再閱讀表 os.chdir(pwd)
WindowsError: [Error 3] : 'C:\\Users\\Administrator\\Desktop\\Course comments\\\xe6\xb1\x87\xe5\x90\x88'does not exist
歷經了千辛萬苦才發現,原來是無法讀取中文命名的檔案。。。其實就是編碼問題,在引入中文路徑的時候,前面加一個u' ... '即可,真是傻的沒邊了我。。。
所以以後檔名最好還是避免取中文名稱吧。就醬
相關推薦
python讀取已存在檔案報錯windowserror:[error 3]
怨念太深。。開始讀取檔案程式碼為: import pandas as pd Input=pd.read_csv(excelPath, index_col=0,encoding='utf-8',low_memory=False) 報錯: IOError: File C:\
報錯WindowsError: [Error 3]
os.path 內容 創建 應該 mkdir today error ror day today_report_path = os.paht.join(report_path, today) if not os.path.isdir(today_report_path):
python 呼叫dll 報錯 WindowsError: [Error 126]
呼叫程式碼 注意:C++檔案(cpp):(在函式宣告上加上extern "C" 的修飾)否則方法名不會被python識別 載入的時候要根據你將要呼叫的函式是符合什麼呼叫約定的。 windll和cdll分別是WinDLL類和CDll類的物件 stdcall呼叫約定:
ApplicationContext讀取xml配置檔案 報錯
配置檔案: public class App { public static void main( String[] args ) { ApplicationContext appContext = new ClassPathXmlAppl
瀏覽器訪問IIS伺服器上面的plist檔案報錯 HTTP Error 404 3 - Not Found
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
瀏覽器訪問IIS伺服器上面的plist檔案報錯 HTTP Error 404 3
報錯:HTTP Error 404.3 - Not FoundThe page you are requesting cannot be served because of the extension configuration. If the page is a script
建立SpringBoot專案pom檔案報錯:Error parsing lifecycle processing instructions
需求描述:採用SpringBoot做了一個快速入門的demo。 問題描述:在pom檔案中,引入SpringBoot的父依賴時,pom檔案報錯。 錯誤資訊:Error parsing lifecycl
python讀取xml檔案報錯xml.parsers.expat.ExpatError: XML or text declaration not at start of entity
先說明一下我之前對python的xml.dom.minidom模組不熟,遇到這個問題時先想到的是百度,結果轉了一圈回來發現大家都寫的是xml檔案中的第一行,也就是 <?xml version="1.0" encoding="GBK"?> 這個可能沒有頂格寫,有空格。可是我遇到的問
python檔案讀取,json解析報錯的原因
前言 環境: python 3.6 詳情 報 ascii cannot decode ‘XXX’ in range…. 這個問題有很多人回答,包括有sys.setdefau
【Python】讀取cvs文件報錯:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 6: invalid start byte
spl 重慶 http posit nbsp div ack lin pan 現在有文件data.csv 文件編碼格式為:ANSI data.csv 1|1|1|北京市 2|1|2|天津市 3|1|3|上海市 4|1|4|重慶市 5|1|5|石家莊市 6|
Python建立檔案報錯OSError:[Errno 22] Invalid argument處理
問題: windows平臺下使用python open函式w模式開啟檔案報錯“OSError: [Errno 22] Invalid argument: '../news/“消費升維”成零售業新風口?渠道多元同步跟進.txt'” 解決: 本來猜測是轉義
jxl讀取設定過資料有效性的xls檔案報錯
1 //在用jxl讀入excel時,一直報如下錯誤: 2 Warning: Cannot read drop down range Unrecognized token 43 3 Exception in thread "main" java.lang.NullPointerExceptionat j
【轉載】讀取txt檔案報錯:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 0
python在open讀取txt檔案時,出現UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xc8 in position 0: invalid continuation byte報錯 解決辦法有二: ①把編碼方式utf-8
spark連線並讀取本地檔案報錯總結
1.scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps; 錯誤原因:scala版本與spark版本相容問題導致,可在maven倉庫看spark所使用jar包支援的scala版本。 注
Python3 pandas read_csv 讀取txt檔案報錯:IOError: Initializing from file failed
錯誤程式碼: data=pd.read_csv(‘C:\Users\lenovo\Desktop\停用詞檔案\字尾詞處理260\handle_data_01.txt’,sep=’\n’) print
hadoop平臺讀取檔案報錯
背景: 生產環境有個指令碼執行讀取st層表資料時出現IO錯誤,查看錶目錄下的檔案,都是壓縮後的檔案。詳細資訊如下: Task with the most failures(4): ----- Task ID: task_201408301703_172845_m_00350
Error using xlsread (matlab 讀取檔案報錯)
在使用matlab中的 xlsread 函式時,可能會報如下錯誤: Error using xlsread (line 251) Error in TSAF>pushbutton1_Call
使用nohup執行python檔案報錯:Import error: No module named XXX等
最近在用linux跑神經網路模型,由於跑一輪時間比較長,而且網路不穩定Xshell容易斷開,所以需要使用nohup執行python檔案,但是遇到了問題。在linux下可以直接使用python test.py執行的檔案,使用nohup python test.py就會報錯,報的
伺服器磁碟空間已滿造成:SSH傳輸檔案報錯
linux檢視目錄大小及硬碟大小的命令: 檢視當前目錄大小: [[email protected]]# du -sh /var/www 檢視指定目錄大小: [[email protected]]# du -sh /www/typengine.com 檢視當前目錄檔案總數: [[em
Python 寫檔案報錯TypeError的解決辦法
處理上傳的檔案: f1 = request.FILES['pic'] fname = '%s/%s' % (settings.MEDIA_ROOT, f1.name) with open(fname, 'w') as pic: