NameError: global name 'WindowsError' is not defined

Bug #1412015 reported by Ryne Everett on 2015-01-17
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Zope 2
Undecided
Unassigned

Bug Description

I'm using Plone on linux, and keep getting the following traceback:

Traceback (most recent call last):
  File "/usr/local/Plone/zinstance/parts/instance/bin/interpreter", line 293, in <module>
    exec(compile(__file__f.read(), __file__, "exec"))
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/run.py", line 76, in <module>
    run()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/run.py", line 22, in run
    starter.prepare()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/__init__.py", line 83, in prepare
    self.makeLockFile()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/__init__.py", line 286, in makeLockFile
    except (IOError, WindowsError):
NameError: global name 'WindowsError' is not defined

WindowsError is used only twice in the project, both times in that file. I know of two ways this could be fixed:

1. Use the more general OSError, from which WindowsError inherits.
2. Use this pattern at the module scope, which you can find in the standard library's shutil module:

try:
    WindowsError
except NameError:
    WindowsError = None

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers