这种错误的出现是在使用built-in函数file()或者open()的时候。或者是因为文件的打开模式不对,或者是文件名有问题。前者的话只需要注意文件是否可读或者可写就可以了。后者则是与文件路径相关的问题,需要在文件名前加r或者R转义,如:file(r"e:\Test.txt",'r').或者将反斜杠\变成两个,如file("e:\\Test.txt",'r').

例如

  

scipy.io.loadmat('F:\Data.mat')

IOError: [Errno 22] invalid mode ('rb') or filename: 'F:\Data.mat'

解决办法

scipy.io.loadmat('F:\\Data.mat')    //只需加反斜线即可

  

IOError: [Errno 22] invalid mode ('rb') or filename: 'F:\netData1.mat'的更多相关文章

  1. IOError: [Errno 22] invalid mode ('rb') or filename: 'C

    dataset = scipy.io.loadmat('F:\test_data.mat') 报错 IOError: [Errno ] invalid mode ('rb') or filename: ...

  2. 【Error】IOError: [Errno 22] invalid mode ('wb') or filename

    错误描述: IOError: [Errno 22] invalid mode ('wb') or filename: 'C:\\Users\\Viral Patel\\Documents\\GitHu ...

  3. Python报错IOError: [Errno 22] invalid mode ('r') or filename

    IOError: [Errno 22] invalid mode ('r') or filename: 这种错误的出现是在使用built-in函数file()或者open()的时候. 或者是因为文件的 ...

  4. python IOError: [Errno 22] invalid mode ('r') or filename:

    如果你是报这个错误,可能是因为你的文件路径中的中文字符太多的缘故. 你可以将路径或者文件名称改为英文试试.

  5. 【Error】IOError: [Errno 22] invalid mode

    使用python打开或写入文件时会报以下错误IOError: [Errno 22] invalid mode,比如打开f:\nnpm.txt时,可以在地址前面加上r或R,即r'f:\nnpm.txt' ...

  6. Python IOError: [Errno 22] invalid mode ('r') 解决方法

    环境 Anaconda3 Python 3.6, Window 64bit 书籍 O'Reilly出版的Wes McKinney编的<Python for Data Analysis> r ...

  7. 【Selenium】【BugList9】windows环境,fp = open("./"+ time.strftime("%Y-%m-%d %H:%M:%S") + " result.html",'wb'),报错:OSError: [Errno 22] Invalid argument: './2018-09-05 10:29:32 result.html'

    [代码] if __name__=="__main__": suite = unittest.TestSuite() suite.addTest(Baidu("test_ ...

  8. python使用open的OSError: [Errno 22] Invalid argument错误

    这两天在写一个新闻类的spider时,遇到了OSError: [Errno 22] Invalid argument这个错误,苦恼的两天,无果.后来通过请教学长,发现原来是打开的文件名中含有一些系统的 ...

  9. Python创建文件报错OSError:[Errno 22] Invalid argument处理

    问题: windows平台下使用python open函数w模式打开文件报错“OSError: [Errno 22] Invalid argument: '../news/“消费升维”成零售业新风口? ...

随机推荐

  1. 8-----BBS论坛

    BBS论坛(八) 8.1.发送邮箱验证码功能 (1)cms/resetemail.html {% from 'common/_macros.html' import static %} {% bloc ...

  2. python-综合练习题(if条件语句,while循环,奇数偶数

    练习题: 1.使用while循环输入1 2 3 4 5 6      8 9 10 2.求1-100的所有数的和 3.输出1-100内所有的奇数 4.输出1-100内所有的偶数 5.求1-2+3-4+ ...

  3. [转]Javascript的匿名函数

    本文转自:http://dancewithnet.com/2008/05/07/javascript-anonymous-function/ 一.什么是匿名函数? 在Javascript定义一个函数一 ...

  4. Murano py27和py34的兼容处理

    tox.ini envlist = py27,py34,pep8 1. django.utils.encoding.force_unicode替换成django.utils.encoding.forc ...

  5. Murano Application

    OpenStack Application Link: http://apps.openstack.org/ Those applications include Murano packages, H ...

  6. ThreadFactory

    在Java中有两类线程:User Thread(用户线程).Daemon Thread(守护线程) 比如,任何一个守护线程都是整个JVM中所有非守护线程的保姆:只要当前JVM实例中尚存在任何一个非守护 ...

  7. Xtrareport绘制行号

    需要是用事件beforePrint (在打印数据之前的事件) private void xrTableCell12_BeforePrint(object sender, System.Drawing. ...

  8. js获取省市

    前台代码 @{ IList<Provinces> allProvinces = ViewBag.AllProvinces; IList<Districts> allDistri ...

  9. 在快速自定义的NopCommerce中使用实体框架(EF)代码优先迁移

    我看到很多nopCommerce论坛的用户问他们如何使用Entity Framework(EF)代码优先迁移来自定义nopCommerce,添加新的字段和entites核心.我实际上在做nopComm ...

  10. webpack-dev-server.js 服务器配置说明

    connect-history-api-fallback 使用: var app = express() var histroy = require('connect-history-api-fall ...