[ python-Bugs-839151 ] attempt to access sys.argv when it doesn't exist

SourceForge.net noreply at sourceforge.net
Mon Nov 10 05:56:09 EST 2003


Bugs item #839151, was opened at 2003-11-10 11:56
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=839151&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Bram Moolenaar (vimboss)
Assigned to: Nobody/Anonymous (nobody)
Summary: attempt to access sys.argv when it doesn't exist

Initial Comment:
When using Python as an extension to another program,
giving a warning message attempts to access sys.argv
while it doesn't exist.

The problem can be reproduced with Vim when compiled
with Python 2.3.  Use these two commands:
    :py import sys
    :py print sys.maxint + 1

The problem is caused by the warnings module.  In line
53 it accesses sys.argv[0], but for an embedded
interpreter this doesn't exist.

The suggested fix does an explicit test for the
existence of sys.argv.  That seems to be the cleanest
solution to me.

This problem also existed in Python 2.2.  I didn't try
other versions.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=839151&group_id=5470



More information about the Python-bugs-list mailing list