Arch Linux package 2.4.0-1
With this release I am unable to select or move cards. Running from the command line, I get the following output:
$ pysol
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.7/tkinter/init.py", line 1702, in call
return self.func(*args)
File "/usr/lib/python3.7/site-packages/pysollib/stack.py", line 1134, in clickEventHandler
event, handler, start_drag, cancel_drag)
File "/usr/lib/python3.7/site-packages/pysollib/stack.py", line 1112, in defaultClickEventHandler
self.startDrag(event, sound=sound)
File "/usr/lib/python3.7/site-packages/pysollib/stack.py", line 1254, in startDrag
if i < 0 or not self.canMoveCards(self.cards[i:]):
File "/usr/lib/python3.7/site-packages/pysollib/stack.py", line 2442, in canMoveCards
self._isMoveableSequence(cards)
File "/usr/lib/python3.7/site-packages/pysollib/stack.py", line 2426, in _isMoveableSequence
return self._isSequence(cards)
TypeError: _isSequence() missing 1 required positional argument: 'c2'
Hi! Can you provide us with a sample game name and deal index where it happens?
I took a screenshot to avoid typos in the deal index. The error has occurred in several different deals of Wasp.
The error did not occur when I switched to Free Cell.
It did occur again when I switched to Scorpion, so I now suspect the error is happening in games where you select cards higher in the tableau for movement.
However, on the 2nd Wasp game attached (065522), there is an available move for the QH from the bottom of its column and I was still unable to select it.
Hope this helps. (Reverting again to the pysolfc-2.0-6 package, even though it wipes my statistics.)
Thanks, Kevin! I was able to reproduce it locally with python3 but with the git master code it still works mostly fine in python2, I;ll investigate further
Hi! Thanks for your patience. Please try the patch here - https://github.com/shlomif/PySolFC/commit/b1423665950e7719d582b6d69b92f5589e58c37c .
Sorry for the delay in responding: I have an odd work schedule.
I applied the patch in spider.py and was able to select the bottom card in each tableau, but all other cards are still locked.
I specified the # 69509166831186801863 game and was able to complete the 2 available moves that used the bottom card, so it's an improvement.
Okay, I've taken a look at the code, and I believe I have found a better answer.
[I'm hesitant to say it is the solution, since I haven't done any serious work in Python for over a decade, and have never looked at the Pysol codebase before]
The issue seems to arise from the difference in method resolution between old- and new- style classes. I determined this by going back to the v2.1 source code and comparing program behavior between Python2 and Python3. And I found that under Python2, ScorpionRowStack.canMoveCards resolves to OpenStack.canMoveCards (producing correct behavior), while under Python3 it resolves to SequenceStack_StackMethods.canMoveCards (leading to the error we've seen).
[insert rant about the evils of multiple inheritance ;-) ]
So, what I have done to fix the issue in v2.5.5 is:
I haven't had time to test this thoroughly, and there are only a few solitaire games that I play, but this appears to fix the issue at least in Spider, Scorpion, and Wasp.
BTW, I have forked Shlomi's GitHub repo, so I could do a pull request, but as I said, I am not familiar with the codebase and have no idea what breakage my kludge might cause in other areas. I'm also not clear if said repo is the canonical source location these days?
Hope this helps.
Last edit: Caelia Renee Chapin 2018-11-17
Actually, I guess that change should be in SequenceRowStack rather than SS_RowStack.
Also, on further thought, I guess this can't do any harm, since for any given version of Python there should never be any ambiguity in method resolution, i.e. every subclass of SequenceRowStack should be affected the same way, right?
Hi Caelia!
Thanks for your efforts. The github repo at https://github.com/shlomif/PySolFC is the canonical source as mentioned on https://pysolfc.sourceforge.io/ . Please send a pull-req and you can also try adding a regression test.
Kevin: please try the patch at https://github.com/shlomif/PySolFC/commit/c0076b5b36c06a3aed9a58590c51eb4692ace653 on top of the previous patch and let me know if everything is OK. Caelia: thanks! I ended up incorporating your change myself, and wrote a test,