Christian Heimes added the comment:

I've a far better patch that uses Python's infrastructure to report the
error:

Index: Modules/main.c
===================================================================
--- Modules/main.c      (Revision 58966)
+++ Modules/main.c      (Arbeitskopie)
@@ -132,6 +132,16 @@
                        (void) PyRun_SimpleFileExFlags(fp, startup, 0, cf);
                        PyErr_Clear();
                        fclose(fp);
+               } else {
+                       int save_errno;
+
+                       save_errno = errno;
+                       PySys_WriteStderr("Could not open PYTHONSTARTUP\n");
+                       errno = save_errno;
+                       PyErr_SetFromErrnoWithFilename(PyExc_IOError,
+                                       startup);
+                       PyErr_Print();
+                       PyErr_Clear();
                }
        }
 }


$ ./python
Python 3.0a1+ (py3k:58966M, Nov 14 2007, 17:17:06)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Could not open PYTHONSTARTUP
IOError: [Errno 2] No such file or directory:
'/home/heimes/.python/startup.py'
>>>                      

Fixed in r58969 (py3k)

----------
resolution:  -> accepted
versions:  -Python 3.0

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1442>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to