cloudflare-ddns-client icon indicating copy to clipboard operation
cloudflare-ddns-client copied to clipboard

Changed python to python3 for compatibility

Open Morpheus0x opened this issue 4 years ago • 3 comments

The script didn't work out of the box since I had python2.7 and python3 installed. For systems with both installed, the python executable is version 2.7. Therefore the change to python3 is needed.

Morpheus0x avatar May 17 '20 09:05 Morpheus0x

The script works in python2 so using python instead of python3 lets the machine decide which installation it should use. Your approach would crash on a machine with only py2 installed!

zaanposni avatar May 17 '20 12:05 zaanposni

Running python2.7 cloudflare-ddns i get this error, with all required packages installed from requirements.txt

Traceback (most recent call last):
  File "cloudflare-ddns", line 10, in <module>
    from tld import get_fld
  File "/usr/local/lib/python2.7/dist-packages/tld/__init__.py", line 7, in <module>
    from .utils import get_fld, get_tld, get_tld_names, is_tld, parse_tld, Result, update_tld_names
  File "/usr/local/lib/python2.7/dist-packages/tld/utils.py", line 10, in <module>
    from backports.functools_lru_cache import lru_cache
ImportError: No module named functools_lru_cache

python3 cloudflare-ddns works...

Morpheus0x avatar May 17 '20 13:05 Morpheus0x

To the best of my knowledge the script should be backwards-compatible with Python 2 and we deliberately defer to your distro's choice of Python to choose one to use.

For the import error, I found some solutions by searching Google. Try pip install --upgrade backports.functools_lru_cache or similar.

LINKIWI avatar May 17 '20 16:05 LINKIWI