Skip to content

DOC: error 'being used by another process' when removing temp files on Windows #5933

Open
@jorisvandenbossche

Description

@jorisvandenbossche

When building the docs on Windows, I get some errors related to the removal of temporary files. For example, for building io.rst:

reading sources... [100%] io
---------------------------------------------------------------------------
WindowsError                              Traceback (most recent call last)
<ipython-input-124-e1699a291992> in <module>()
----> 1 os.remove('tmp.sv')
WindowsError: [Error 32] The process cannot access the file because it is being
used by another process: 'tmp.sv'
---------------------------------------------------------------------------
WindowsError                              Traceback (most recent call last)
<ipython-input-371-8e84b2979f2e> in <module>()
----> 1 os.remove('store.h5')
WindowsError: [Error 32] The process cannot access the file because it is being
used by another process: 'store.h5'
  • For temp.sv this is due to:

    reader = pd.read_table('tmp.sv', sep='|', iterator=True)
    reader.get_chunk(5)
    

    where reader is still 'open'. A following os.remove('tmp.sv') will generate this error. Is there a way to close a TextFileReader object?

  • For store.h5 this is due to the last os.remove('store.h5') (before 'SQL queries' http://pandas.pydata.org/pandas-docs/dev/io.html#sql-queries). For this, I don't directly see why this fails, as all the other calls to os.remove('store.h5') do work (and there is a store.close() command)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions