Bugs item #839151, was opened at 2003-11-10 10:56 Message generated for change (Settings changed) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=839151&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.3 Status: Closed Resolution: Fixed Priority: 5 Submitted By: Bram Moolenaar (vimboss) >Assigned to: Georg Brandl (gbrandl) >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. ---------------------------------------------------------------------- Comment By: Georg Brandl (birkenfeld) Date: 2005-06-26 22:55 Message: Logged In: YES user_id=1188172 Thanks for the report; this is fixed as of Lib/warnings.py r1.27, r1.24.2.2. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2003-11-19 05:23 Message: Logged In: NO Much simplier test: >>> import sys >>> del sys.argv >>> sys.maxint+1 Traceback (most recent call last): File "<stdin>", line 1, in ? File "D:\development\python22\lib\warnings.py", line 38, in warn filename = sys.argv[0] AttributeError: 'module' object has no attribute 'argv' ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2003-11-19 05:22 Message: Logged In: NO Much simplier test: >>> import sys >>> del sys.argv >>> sys.maxint+1 Traceback (most recent call last): File "<stdin>", line 1, in ? File "D:\development\python22\lib\warnings.py", line 38, in warn filename = sys.argv[0] AttributeError: 'module' object has no attribute 'argv' ---------------------------------------------------------------------- Comment By: Neal Norwitz (nnorwitz) Date: 2003-11-10 15:02 Message: Logged In: YES user_id=33168 Just to provide a reference, 839200 was a duplicate of this report. I closed 839200. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=839151&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com