Why don't we get an ERRNO.py (at least on unix systems) 
Author Message
 Why don't we get an ERRNO.py (at least on unix systems)

Dear readers,
        and Guido at first, after much help from the list, I started doing
some CGI coding, and managed to get a working ident inside my script (to
work around an apache glitch I still don't understand). Now, the code is
general enough, but the error handling is (at least) rudimentary, since we
have the single exception socket.error raised. Now, socket.error gives
something of a little more use, namely, the 2-ble <errno, errname>, but I
don't think we could rely on error names for error checking (say what
happens if you have a localized libc, and need to work with LANG set).
Then comes the errno, but it is inherently changing from one system to the
other (just checked making ERRNO.py with h2py on a Solaris and a Linux
sytem). The only invariant part is the posix mandated error name, which I
could hope will remain the same even on `good' PC c compilers. Therefore,
I think that generating and adding such a module at compile/install time
could make only good to us.

As a matter of fact, here I am attaching some lines I got applying wdiff
to the (sorted) Solaris and Linux ERRNO.py files. As you can see, there
are four different kind of error names: some error names which share the
same error number on both systems, some other which are present only on
solaris or on linux, and then the (many) other ones, which share the same
name, but have different numbers.

Yours,

        lorenzo

PS what I really needed was the ECONNREFUSED error number, which I am now
certain I couldn't rely upon, at least until we'll have an ERRNO.py
installed...

PPS I still don't understand all the error are classes thing, but, if it
would mean we can access in a simpler way to those two parts of the double
doing a chech for
        raised.errno
and printing
        raised.errmessage

It is great.

edited wdiff output:
---------------------------------------------------------------------
# Generated by h2py from [-/usr/include/asm/errno.h-] {+sol_errno.h+}
EADDRINUSE = [-98-] {+125+}
EADDRNOTAVAIL = [-99-] {+126+}
EADV = 68
EBUSY = 16
[...]
{+ECANCELED = 47+}
[...]
ECONNREFUSED = [-111-] {+146+}
ECONNRESET = [-104-] {+131+}
EDEADLK = [-35-] {+45+}
EDEADLOCK = [-EDEADLK-] {+56+}
EDESTADDRREQ = [-89-] {+96+}
EDOM = 33
[-EDOTDOT = 73-]



Tue, 25 Jul 2000 03:00:00 GMT  
 Why don't we get an ERRNO.py (at least on unix systems)

Check out the builtin module errno. This should define everything
you need, on all platforms that support E-errors (Unix) or WSA-errors
(windows).
--
Marc-Andre Lemburg



Tue, 25 Jul 2000 03:00:00 GMT  
 Why don't we get an ERRNO.py (at least on unix systems)

Quote:

> Check out the builtin module errno. This should define everything
> you need, on all platforms that support E-errors (Unix) or WSA-errors
> (windows).

ME STUPID... but maybe some pointer around the library reference could
help... inside socket docs it is said to see posix, and then inside posix
I read the posix.error returns a double (errno, errcode). I got with
Guido's suggestion to keep wandering through the book, instead of
following a strictly sequential order... maybe that's the only paragraph
needing to be changed, but I think a couple of poiters from socket and
posix to errno couldn't do any harm...

Sorry for band waste, and thank you very much

Yours,

lorenzo

PS Just in case you didn't get it... ME STUPID



Tue, 25 Jul 2000 03:00:00 GMT  
 Why don't we get an ERRNO.py (at least on unix systems)

BTW: The module tries to map the Windows error codes to the Unix
E-codes, so if you write your app using the E-codes it is also
likely to run on Windows platforms. (Maybe that should also be
mentioned in the docs...)
--
Marc-Andre Lemburg



Tue, 25 Jul 2000 03:00:00 GMT  
 Why don't we get an ERRNO.py (at least on unix systems)

Lorenzo M. Catucci:

Quote:
> As a matter of fact, here I am attaching some lines I got applying wdiff
> to the (sorted) Solaris and Linux ERRNO.py files. As you can see, there
> are four different kind of error names: some error names which share the
> same error number on both systems, some other which are present only on
> solaris or on linux, and then the (many) other ones, which share the same
> name, but have different numbers.

In 1.5, you don't need ERRNO.py any more (in fact I should remove it
from the distribution -- it's only provided for IRIX anyway).
Instead, there's the built-in module "errno" which picks up the error
names and numbers at compile time.  See the 1.5 library reference manual.

--Guido van Rossum (home page: http://www.python.org/~guido/)



Tue, 25 Jul 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. don't understand cause of `sysread': Bad file descriptor (Errno::EBADF)

2. The Smalltalk Store: Why we've been slow, and why we're getting better

3. puts sometimes gives:in `write': Interrupted system call (Errno::EINTR)

4. Tk system fonts don't match actual system fonts

5. something i don't understand; py cookbook

6. Don't getting started the Help Site, the Tutorial and the Education Centre

7. Cookie gets me an errormessage I don't understand

8. unix/dltest don't use correct variables for build

9. Unix style font sizes on Windows don't work

10. Why patterns don't suck

11. why awk don't display the results?

12. Why I don't Like HTML Help...

 

 
Powered by phpBB® Forum Software