这种错误的出现是在使用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. python 数据可视化---Anscombe’s quartet

    import seaborn as sns sns.set(style="ticks") # Load the example dataset for Anscombe's qua ...

  2. Tomcat在处理GET和POST请求时产生的乱码问题

    最近一直在做关于Servlet的事情,常常出现乱码,很是烦人,处理乱码的方法有时候有效,有时候没有效果,今天抽个时间小结一下,以防以后再出现这种问题. 一般的处理乱码的方式都是用: request.s ...

  3. myEclipse更换SVN登录账号

    Win10下 找到下面路径删除其下的所有文件 C:\Users\Administrator\AppData\Roaming\Subversion\auth\svn.simple AppData默认隐藏 ...

  4. 3d Max 2019安装失败怎样卸载3dsmax?错误提示某些产品无法安装装

    AUTODESK系列软件着实令人头疼,安装失败之后不能完全卸载!!!(比如maya,cad,3dsmax等).有时手动删除注册表重装之后还是会出现各种问题,每个版本的C++Runtime和.NET f ...

  5. apache配置多端口对应多个虚拟目录

    经常需要在本地调试网站,却又不喜欢在http://localhost/网站的文件夹名 且几个比较重要的项目我想直接用端口号以示区分,想达到的效果如下: http://localhost/ 默认80端口 ...

  6. .NET面试题5

    常见面试题目: 1. const和readonly有什么区别? 2. 哪些类型可以定义为常量?常量const有什么风险? 3. 字段与属性有什么异同? 4. 静态成员和非静态成员的区别? 5. 自动属 ...

  7. Day5下

    T1 #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> ...

  8. Git GUI基本操作

    一.Git GUI基本操作 1.版本库初始化 gitpractise文件夹就变成了Git可以管理的仓库,目录下多了一个.git文件夹,此目录是Git用于管理版本库的,不要擅自改动里面的文件,这样会破坏 ...

  9. iOS 警告收集快速消除

    1.ld: warning: directory not found for option 去掉警告的方法 工程老是提示ld: warning: directory not found for opt ...

  10. maven常用依赖

    HttpServletRequest HttpServletResponse <dependency> <groupId>javax.servlet</groupId&g ...