Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
7aa78432
Commit
7aa78432
authored
Dec 01, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TempFS.close(): recover from temporarily locked resources on win32
parent
f036682f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
fs/tempfs.py
+17
-2
No files found.
fs/tempfs.py
View file @
7aa78432
#!/usr/bin/env python
#!/usr/bin/env python
import
os
import
os
from
osfs
import
OSFS
import
time
import
tempfile
import
tempfile
from
fs.osfs
import
OSFS
from
fs.errors
import
*
from
fs.errors
import
*
class
TempFS
(
OSFS
):
class
TempFS
(
OSFS
):
...
@@ -30,13 +31,27 @@ class TempFS(OSFS):
...
@@ -30,13 +31,27 @@ class TempFS(OSFS):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
unicode
(
self
.
__str__
())
return
unicode
(
self
.
__str__
())
@convert_os_errors
def
close
(
self
):
def
close
(
self
):
"""Removes the temporary directory.
"""Removes the temporary directory.
This will be called automatically when the object is cleaned up by
This will be called automatically when the object is cleaned up by
Python. Note that once this method has been called, the FS object may
Python. Note that once this method has been called, the FS object may
no longer be used.
no longer be used.
"""
"""
try
:
self
.
_close
()
except
ResourceLockedError
:
# Give win32 a chance to clean up after itself
time
.
sleep
(
0.5
)
self
.
_close
()
@convert_os_errors
def
_close
(
self
):
"""Actual implementation of close().
This is a separate method so it can be re-tried in the face of
transient errors.
"""
if
not
self
.
_cleaned
and
self
.
exists
(
"/"
):
if
not
self
.
_cleaned
and
self
.
exists
(
"/"
):
self
.
_lock
.
acquire
()
self
.
_lock
.
acquire
()
try
:
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment