Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

portalocker: more descriptive error if pywin32 isn't installed, fixed…

… dep name (as per pypi) in readme
  • Loading branch information...
commit f90fd8ce185711e027f326c30961cca7d08b2689 1 parent 2986194
@mk-fg authored
Showing with 12 additions and 5 deletions.
  1. +4 −2 README.md
  2. +1 −1  setup.py
  3. +7 −2 skydrive/portalocker.py
View
6 README.md
@@ -186,11 +186,13 @@ without any installation, if that's the only thing you need there.
higher are strongly recommended - ideally 1.0.0+ (see "Known Issues" section
below for rationale)
-* (only on windows platforms) [win32all](http://sourceforge.net/projects/pywin32/)
-
* (optional, recommended) [PyYAML](http://pyyaml.org) - required for CLI tool
and optional persistent-state ("conf") module only.
+* (only on windows) [pywin32](http://sourceforge.net/projects/pywin32/) - for
+ CLI tool (used to lock configuration file on changes) and optional conf module
+ only.
+
* (optional) [chardet](http://pypi.python.org/pypi/chardet) - used to detect
encoding (utf-8, gbk, koi8-r, etc) of the command-line arguments to support
workng with non-ascii (e.g. cyrillic, chinese) names, if it's not specified
View
2  setup.py
@@ -14,7 +14,7 @@
setup(
name='python-skydrive',
- version='13.03.21',
+ version='13.03.22',
author='Mike Kazantsev, Antonio Chen',
author_email='mk.fraggod@gmail.com',
license='WTFPL',
View
9 skydrive/portalocker.py
@@ -1,9 +1,13 @@
#-*- coding: utf-8 -*-
import os
-# needs win32all to work on Windows (NT, 2K, XP, _not_ /95 or /98)
+
if os.name == 'nt':
- import win32con, win32file, pywintypes
+ # Needs pywin32 to work on Windows (NT, 2K, XP, _not_ /95 or /98)
+ try: import win32con, win32file, pywintypes
+ except ImportError as err:
+ raise ImportError( 'Failed to import pywin32'
+ ' extensions (make sure pywin32 is installed correctly) - {}'.format(err) )
LOCK_EX = win32con.LOCKFILE_EXCLUSIVE_LOCK
LOCK_SH = 0 # the default
@@ -17,6 +21,7 @@ def lock(file, flags):
def unlock(file):
hfile = win32file._get_osfhandle(file.fileno())
win32file.UnlockFileEx(hfile, 0, 0x7FFFFFFF, __overlapped)
+
elif os.name == 'posix':
import fcntl
from fcntl import LOCK_EX, LOCK_SH, LOCK_NB
Please sign in to comment.
Something went wrong with that request. Please try again.