ktdreyer / python-nfsn

Python library for accessing NearlyFreeSpeech.net's API
Creative Commons Zero v1.0 Universal
14 stars 0 forks source link

Python 3.6.x support #1

Open jefft opened 6 years ago

jefft commented 6 years ago

As the README notes, this works up to Python 3.5. Trying with 3.6.3 (the default in recent Ubuntu) yields sadness:

(testpynfsn) jturner@jturner-desktop:/tmp$ pynfsn member jturner accounts
Traceback (most recent call last):
  File "/tmp/testpynfsn/bin/pynfsn", line 7, in <module>
    from nfsn.cli import main
  File "/tmp/testpynfsn/lib/python3.6/site-packages/nfsn/__init__.py", line 2, in <module>
    from .nfsnbeanbag import NfsnBeanBag
  File "/tmp/testpynfsn/lib/python3.6/site-packages/nfsn/nfsnbeanbag.py", line 7, in <module>
    class NfsnBeanBag(BeanBag):
TypeError: __class__ set to <class 'nfsn.nfsnbeanbag.NfsnBeanBagBase'> defining 'NfsnBeanBag' as <class 'nfsn.nfsnbeanbag.NfsnBeanBag'>

I'm not sufficiently up to scratch on Python to offer a fix. A workaround is to install a local Python 3.5.4. On Ubuntu this works for me:


# Install Python 3.5.4
apt install libssl-dev openssl
cd /tmp
curl -OJ https://www.python.org/ftp/python/3.5.4/Python-3.5.4.tar.xz
tar xf Python-3.5.4.tar.xz
cd Python-3.5.4/
./configure --prefix=$HOME/python3
make altinstall   # Per https://askubuntu.com/questions/682869/how-do-i-install-a-different-python-version-using-apt-get61249593366
cd /tmp
virtualenv --python=$HOME/python3/bin/python3.5 virtualenv
source virtualenv/bin/activate
pip install python-nfsn
pynfsn member jturner accounts   # Now works!
ktdreyer commented 6 years ago

Hi Jeff, you're right, this is broken in Python 3.6. I'm sorry I have not made time yet to look into whether it's python-nfsn or Beanbag itself that is broken here, though I'm definitely interested in resolving this.

ktdreyer commented 6 years ago

Possibly related: https://github.com/ajtowns/beanbag/issues/11

jeff-bowman commented 3 years ago

For the time being, I've worked around the issue by running pip3 install git+https://github.com/stratakis/beanbag@8cea464660194f2628f9ae5fe797be8e690015c1, as that matches the ready-but-stale pull request ajtowns/beanbag#10. It would likely be sufficient to install git+https://github.com/stratakis/beanbag if you don't mind a branch that may change, or you could even refer to the pull request exactly.

I suppose you could also list one of those alternatives in python-nfsn's setup.py, though I don't know the rules or etiquette of listing a GitHub fork as a requirement instead of an officially-listed PyPI entry.

(Thank you for making and sharing this package, by the way! I'm glad there are still options to consume it.)

ktdreyer commented 2 years ago

Yeah we need to switch entirely away from Beanbag at this point.