Questions tagged [ioerror]

Anything related to Input/Output errors, i.e. errors happening while a program is performing an I/O operation, such as opening a file, reading from a stream, writing to a socket, etc.

Anything related to Input/Output errors, i.e. errors happening while a program is performing an I/O operation, such as opening a file, reading from a stream, writing to a socket, etc.

351 questions
85
votes
3 answers

What can lead to "IOError: [Errno 9] Bad file descriptor" during os.system()?

I am using a scientific software including a Python script that is calling os.system() which is used to run another scientific program. While the subprocess is running, Python at some point prints the following: close failed in file object…
Dr. Jan-Philip Gehrcke
  • 33,287
  • 14
  • 85
  • 130
78
votes
5 answers

PIL cannot write mode F to jpeg

I am taking a jpg image and using numpy's fft2 to create/save a new image. However it throws this error "IOError: cannot write mode F as JPEG" Is there an issue with CMYK and JPEG files in PIL??? p = Image.open('kibera.jpg') bw_p =…
JHHP
  • 781
  • 1
  • 5
  • 4
49
votes
4 answers

Python's "open()" throws different errors for "file not found" - how to handle both exceptions?

I have a script where a user is prompted to type a filename (of a file that is to be opened), and if the file doesn't exist in the current directory, the user is prompted again. Here is the short version: file = input("Type filename: ") ... try: …
user2015601
43
votes
4 answers

Why is mod_wsgi not able to write data? IOError: failed to write data

What could be causing this error: $ sudo tail -n 100 /var/log/apache2/error.log' [Wed Dec 29 15:20:03 2010] [error] [client 220.181.108.181] mod_wsgi (pid=20343): Exception occurred processing WSGI script '/home/username/public_html/idm.wsgi'. …
BryanWheelock
  • 12,146
  • 18
  • 64
  • 109
38
votes
6 answers

I/O Error: SSO Failed: Native SSPI library not loaded

I am trying to run the following bit of code: import java.sql.DriverManager; public class Connect { public static void main(String[] args){ try{ String databaseDriver = "net.sourceforge.jtds.jdbc.Driver"; …
Nosheen
  • 458
  • 1
  • 5
  • 12
31
votes
6 answers

pip install PyQt IOError

I'm trying to install PyQt package with pip, but I get this error: ~$ pip install PyQt Downloading/unpacking PyQt Downloading PyQt-x11-gpl-4.8.3.tar.gz (9.8Mb): 9.8Mb downloaded Running setup.py egg_info for package PyQt Traceback (most…
J91321
  • 437
  • 1
  • 5
  • 9
31
votes
8 answers

When might an IOError be thrown?

I have never seen a case when an IOError is thrown. The only thing that the docs say about IOError it this: Thrown when a serious I/O error has occurred. There aren't any subclasses or anything else obvious. Is there ever a case when IOError…
Pokechu22
  • 4,984
  • 9
  • 37
  • 62
30
votes
2 answers

python - specifically handle file exists exception

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…
cogitoergosum
  • 2,309
  • 4
  • 38
  • 62
28
votes
4 answers

How to get the errno of an IOError?

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…
jr0d
  • 935
  • 2
  • 8
  • 9
25
votes
7 answers

"No space left on device" error while fitting Sklearn model

I'm fitting a LDA model with lots of data using scikit-learn. Relevant code piece looks like this: lda = LatentDirichletAllocation(n_topics = n_topics, max_iter = iters, …
machaerus
  • 749
  • 1
  • 6
  • 20
23
votes
7 answers

IOError Input/Output Error When Printing

I have inherited some code which is periodically (randomly) failing due to an Input/Output error being raised during a call to print. I am trying to determine the cause of the exception being raised (or at least, better understand it) and how to…
Mark Streatfield
  • 3,189
  • 1
  • 22
  • 19
22
votes
5 answers

Multiprocessing IOError: bad message length

I get an IOError: bad message length when passing large arguments to the map function. How can I avoid this? The error occurs when I set N=1500 or bigger. The code is: import numpy as np import multiprocessing def func(args): i=args[0] …
Andy
  • 1,072
  • 2
  • 19
  • 33
21
votes
4 answers

Region: IOError: [Errno 22] invalid mode ('w') or filename

I'm not sure why, but for some reason, whenever I have "region" in the file name of the output file, it gives me this error: IOError: [Errno 22] invalid mode ('w') or filename: 'path\regionlog.txt' It does this for "region.txt", "logregion.txt",…
FaerieDrgn
  • 305
  • 2
  • 3
  • 9
19
votes
2 answers

OError: [Errno 26] Text file busy: '/...myvirtualenv/bin/python'

I try to recreate the virtualenv: foo_bar_d@aptguettler:~$ virtualenv --system-site-packages . I get this exception: foo_bar_d@aptguettler:~$ virtualenv --system-site-packages . New python executable in /home/foo_bar_d/bin/python Traceback (most…
guettli
  • 25,042
  • 81
  • 346
  • 663
19
votes
7 answers

Write to a file with sudo privileges in Python

The following code throws an error if it's run by a non-root user for a file owned by root, even when the non-root user has sudo privileges: try: f = open(filename, "w+") except IOError: sys.stderr.write('Error: Failed to open file %s' %…
user2824889
  • 1,085
  • 5
  • 16
  • 28
1
2 3
23 24