sherlock
sherlock copied to clipboard
0.3.2 on pypi does not fix: redis.exceptions.DataError: Invalid input of type: 'UUID'
Sherlock 0.3.2 from pypi and Python 3.6.
File "/usr/local/lib/python3.6/site-packages/sherlock/lock.py", line 171, in acquire
if self._acquire() is not True:
File "/usr/local/lib/python3.6/site-packages/sherlock/lock.py", line 429, in _acquire
expire]) != 1:
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 3575, in __call__
return client.evalsha(self.sha, len(keys), *args)
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 2761, in evalsha
return self.execute_command('EVALSHA', sha, numkeys, *keys_and_args)
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 774, in execute_command
connection.send_command(*args)
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 620, in send_command
self.send_packed_command(self.pack_command(*args))
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 663, in pack_command
for arg in imap(self.encoder.encode, args):
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 125, in encode
"byte, string or number first." % typename)
redis.exceptions.DataError: Invalid input of type: 'UUID'. Convert to a byte, string or number first.
Which it turns out does not match what is checked into master. @vaidik you appear to have created a tgz with older code.
$ diff --exclude .git --exclude .gitignore --exclude .travis.yml --exclude Docker* --exclude Makefile --exclude PKG-INFO --exclude docker-compose.dev.yml --exclude sherlock.egg-info --exclude '*.rst' --exclude conf.py --exclude tests -pruNb ~/tmp/sherlock-0.3.2/ sherlock/
diff --exclude .git --exclude .gitignore --exclude .travis.yml --exclude 'Docker*' --exclude Makefile --exclude PKG-INFO --exclude docker-compose.dev.yml --exclude sherlock.egg-info --exclude '*.rst' --exclude conf.py --exclude tests -pruNb /Users/seanperry/tmp/sherlock-0.3.2/setup.cfg sherlock/setup.cfg
--- /Users/seanperry/tmp/sherlock-0.3.2/setup.cfg 2019-05-11 04:26:46.000000000 -0700
+++ sherlock/setup.cfg 1969-12-31 16:00:00.000000000 -0800
@@ -1,4 +0,0 @@
-[egg_info]
-tag_build =
-tag_date = 0
-
diff --exclude .git --exclude .gitignore --exclude .travis.yml --exclude 'Docker*' --exclude Makefile --exclude PKG-INFO --exclude docker-compose.dev.yml --exclude sherlock.egg-info --exclude '*.rst' --exclude conf.py --exclude tests -pruNb /Users/seanperry/tmp/sherlock-0.3.2/sherlock/lock.py sherlock/sherlock/lock.py
--- /Users/seanperry/tmp/sherlock-0.3.2/sherlock/lock.py 2019-05-11 04:03:35.000000000 -0700
+++ sherlock/sherlock/lock.py 2019-06-04 17:28:34.000000000 -0700
@@ -57,7 +57,7 @@ class BaseLock(object):
...
... def _acquire(self):
... if self.client.get(self.lock_name) is not None:
- ... owner = uuid.uuid4() # or anythin you want
+ ... owner = str(uuid.uuid4()) # or anythin you want
... self.client.set(self.lock_name, owner)
... self._owner = owner
... if self.expire is not None:
@@ -419,7 +419,7 @@ class RedisLock(BaseLock):
return key
def _acquire(self):
- owner = uuid.uuid4()
+ owner = str(uuid.uuid4())
if self.expire is None:
expire = -1
else:
@@ -524,7 +524,7 @@ class EtcdLock(BaseLock):
return '/%s' % self.lock_name
def _acquire(self):
- owner = uuid.uuid4()
+ owner = str(uuid.uuid4())
_args = [self._key_name, owner]
if self.expire is not None:
@@ -641,7 +641,7 @@ class MCLock(BaseLock):
return key
def _acquire(self):
- owner = uuid.uuid4()
+ owner = str(uuid.uuid4())
_args = [self._key_name, str(owner)]
if self.expire is not None:
A common pattern in other repos is to use git tagging to mark releases. This way it is easy for people to examine a specific version of a fix or to look at what changed between versions.
git diff 0.3.0..0.3.2
for example.
When preparing a release you can then do:
$ cd tmp
$ git clone --branch v0.3.2 --depth 1 $GITHUB_REPO_URL sherlock-0.3.2
$ # whatever it takes to prepare repo for release.....
$ tar czvf sherlock-0.3.2.tar.gz sherlock-0.3.2
Hey, I'm having issues because of exactly this, also on python 3.6. Is there a way for me to quickly get around with without subclassing everything to fix it locally? Does a previous version work? I quickly tried 0.3.1 and 0.3.0 but both also failed.
You can add git repos to Pip requirements.txt.
git+https://github.com/vaidik/sherlock@99ef85750d5fa48633b40b798f12668ea91fd700
Will include the fixed version into your project until a proper release is made. Had @vaidik tagged the release the line could have git+https://github.com/vaidik/[email protected]
The fix for this should now be released in v0.4.0
along with a bunch of other fixes and new features! 🥳 Let me know how you guys get on with the project 😁