[Python-bugs-list] [ python-Bugs-408884 ] File not closed

noreply@sourceforge.net noreply@sourceforge.net
Sat, 17 Mar 2001 21:44:08 -0800


Bugs item #408884, was updated on 2001-03-15 11:31
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=408884&group_id=5470

>Category: Windows
>Group: Platform-specific
>Status: Closed
Priority: 5
Submitted By: Charles Hixson (quixo)
Assigned to: Nobody/Anonymous (nobody)
Summary: File not closed

Initial Comment:
Python 2.1a2 (#10, Feb 2 2001, 16:01:03) [MSC 32 bit
(Intel)] on win32

OS Win95 4.00.950 B

In IDLE 0.6 I execute a script that is intended to
create a file.  An indexing error occurs (I used a
paren instead of a square bracket to access a
dictionary).  The program aborts:
Traceback (most recent call last):
  File "C:\Docs\TIP html\tipRec2Html.py", line 509, in ?
    test()
  File "C:\Docs\TIP html\tipRec2Html.py", line 439, in test
    laTitle = leadAgencies(leadAgncy)
TypeError: object is not callable: {'sonco': 'Son Co
Transit', 'santro ....

Rerunning the program yields:

Traceback (most recent call last):
  File "C:\Docs\TIP html\tipRec2Html.py", line 509, in ?
    test()
  File "C:\Docs\TIP html\tipRec2Html.py", line 415, in test
    os.unlink(here + '\html\' + fl)
OSError: [Errno 13] Permission denied: 'C:\Docs\TIP
html\html\hson.htm'

This is the file that was being created when the prior
error occured.  It appears that the file hasn't been
released.  This can be worked around by quitting IDLE
and re-executing it.

If you look at the code you'll probably see that I'm
new to Python.  I made some obvious silly decisions,
just to keep the code easier to think about.  The html1
file mainly declares a couple of methods for writing
out descriptions of HTML table cells, either with or
without titles.  (Sorry there was only room to include
one file... if I'd thought ahead I would have zipped them.)

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

>Comment By: Tim Peters (tim_one)
Date: 2001-03-17 21:44

Message:
Logged In: YES 
user_id=31435

Sorry, but I'm just closing this with a WontFix, and 
setting other fields to Windows and Platform-specific.

There are unbounded ways you can get yourself in trouble by 
writing scripts that don't work, and since IDLE is not an 
operating system it can't go cleaning up OS resources for 
you (IDLE has no idea which files you left open).

Restarting IDLE is the *proper* thing to do here.  Note 
that this is a Windows-specific problem because it's 
Windows that insists you can't unlink an open file; if you 
had done this under Linux instead, no problem.

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

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