ioerror

How to port a Python application to Linux that works fine in Windows

倖福魔咒の 提交于 2020-01-16 04:12:47
问题 I am having trouble porting a working, Windows Python application to Linux. I am having some problems, because I did not write the code and am just learning Python. I am having trouble fixing the issues that it keeps throwing up. So here is a kind of error that right now I am stuck with Traceback (most recent call last): File "alpha_beta", line 237, in <module> main() File "alpha_beta", line 185, in main ABCCmd() File "alpha_beta.py", line 74, in ABCCmd File "C:\softs\Python\Lib\shutil.py",

Python IOError cannot allocate memory although there is plenty

岁酱吖の 提交于 2020-01-16 00:54:29
问题 I've written a basic program to check through a directory tree containing many jpeg files (500000+) verify that they are not corrupted (approximately 3-5% of the files seem to be corrupt in some way) and then take a sha1sum of the files (even the corrupt ones) and save the info into a database. The jpeg files in question are located on a windows system and mounted on the linux box via cifs. They are mostly around 4 megabytes in size, although some maybe slightly larger or smaller. When I run

Errno 22:invalid mode('rb') or filename:' ' while running a spec file while using pyinstaller

旧城冷巷雨未停 提交于 2020-01-14 09:37:06
问题 This is my spec file # -*- mode: python -*- a = Analysis(['final_code.py'], pathex=['C:\\Python27\\PyInstaller-2.1\\final_code'], hiddenimports=[], hookspath=None, runtime_hooks=None) pyz = PYZ(a.pure) exe = EXE(pyz, Tree('C:\\Python27\\data_req\\'), a.scripts, exclude_binaries=True, name='final_code.exe', debug=False, strip=None, upx=True, console=False ) coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=None, upx=True, name='final_code') I have modified it to include the text files

IOError when trying to open existing files

折月煮酒 提交于 2019-12-28 04:35:06
问题 I have a small issue with a python program that I wrote to extract some information from a special text file. The loop (code below) needs to execute my function extract_zcoords() over 500 files (1 file gives one list) so that I can build a dataset. import os def extract_zcoord(filename): f = open(filename, 'r') ... # do something with f ### LOOP OVER DIRECTORY location = '/Users/spyros/Desktop/3NY8MODELSHUMAN/HomologyModels' for filename in os.listdir(location): extract_zcoord(filename) THE

Python + open() + write on Windows - permission issue (IOError) for file created on OS X

随声附和 提交于 2019-12-25 05:36:08
问题 (I asked this previously, but have since accepted that it is not an issue with openpyxl , so changing tack) Given an xlsx created on OS X, I open it for writing on that platform using openpyxl load_workbook() . I add some data, then I save it using Workbook.save() (to the same file). All good on OS X, but when the program, and the XLSX, are transferred onto a Windows machine and executed, I get: c:\Users\Me\Desktop\ROI>python roi_cut7.py > log.txt Traceback (most recent call last): File "roi

python - specifically handle file exists exception

别等时光非礼了梦想. 提交于 2019-12-21 03:18:22
问题 I have come across examples in this forum where a specific error around files and directories is handled by testing the errno value in OSError (or IOError these days ?). For example, some discussion here - Python's "open()" throws different errors for "file not found" - how to handle both exceptions?. But, I think, that is not the right way. After all, a FileExistsError exists specifically to avoid having to worry about errno . The following attempt didn't work as I get an error for the token

Getting “IOError: [Errno 13] Permission denied:..” when importing pandas.DataFrame

拈花ヽ惹草 提交于 2019-12-20 10:44:17
问题 I am getting IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/python_dateutil-2.2-py2.7.egg/EGG-INFO/top_level.txt' when I am trying to import pandas. I don't see why. Importing pandas in the python3 console works just fine. Execution of the code is done with Python3 too start_simulation.py from Market import Market from TestingAlgorithm import TestingAlgorithm from LiteForexHandler import LiteForexHandler from Broker import Broker from Portfolio import Portfolio

How to get the errno of an IOError?

喜你入骨 提交于 2019-12-20 09:46:14
问题 C has perror and errno, which print and store the last error encountered. This is convenient when doing file io as I do not have to fstat() every file that fails as an argument to fopen() to present the user with a reason why the call failed. I was wondering what is the proper way to grab errno when gracefully handling the IOError exception in python? In [1]: fp = open("/notthere") --------------------------------------------------------------------------- IOError Traceback (most recent call

Python “IOError: [Errno 22] Invalid argument” when using cPickle to write large array to network drive

本秂侑毒 提交于 2019-12-18 08:16:12
问题 EDIT: At the suggestion of J. F. Sebastian, I can get the same error much more simply: Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] Type "copyright", "credits" or "license" for more information. IPython 0.10 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. Welcome to pylab, a matplotlib

causes of Python IOError: [Errno 13] Permission denied

南笙酒味 提交于 2019-12-14 03:23:35
问题 When attempting to write a file, I can get this same error when any of following conditions applies: The file exists and is marked read-only. I don't have write permission for the folder and therefore cannot create a file. The file is already open in another process. Is there any way to separate out the above three causes? If not, then I would say that this is an extraordinarily poor design. 回答1: You get the same Exception as your base problem is "You can't do this" but the details are