[New-bugs-announce] [issue1442] pythonstartup addition of minor error checking
Joseph Armbruster
report at bugs.python.org
Wed Nov 14 05:07:24 CET 2007
New submission from Joseph Armbruster:
Trunk revision: 58963
Description: No warning or error is reported it a file pointed to by
PYTHONSTARTUP is not readable.
Request: To display a warning so that the user may be notified.
Note: Errors that may occur in PyRun_SimpleFileExFlags are being cast
away, may be worthwhile to report an error for those as well (unless
this was avoided for good reason :-)
Suggestion:
static void RunStartupFile(PyCompilerFlags *cf)
{
char *startup = Py_GETENV("PYTHONSTARTUP");
if (startup != NULL && startup[0] != '\0') {
FILE *fp = fopen(startup, "r");
if (fp != NULL) {
(void) PyRun_SimpleFileExFlags(fp, startup, 0, cf);
PyErr_Clear();
fclose(fp);
}
else {
fprintf(stderr,"Warning: Could not read startup file %s\n",startup);
}
}
}
----------
components: Interpreter Core
messages: 57482
nosy: JosephArmbruster
severity: minor
status: open
title: pythonstartup addition of minor error checking
type: behavior
versions: Python 2.6
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1442>
__________________________________
More information about the New-bugs-announce
mailing list