datashaman / putio-automator

A suite of commands for managing torrents, transfers and files on put.io. Works well with SickRage, Sonarr, etc.
MIT License
71 stars 17 forks source link

Issue with putio config init #36

Closed ZerithZA closed 3 years ago

ZerithZA commented 3 years ago

Hi,

I did a new install on two different Ubuntu 18.04.5 LTS boxes and on both I get the following error when running the putio config init command.

Traceback (most recent call last): File "/home/zerith/.local/bin/putio", line 5, in from putio_automator.cli import main File "/home/zerith/.local/lib/python3.6/site-packages/putio_automator/cli.py", line 34, in from . import commands File "/home/zerith/.local/lib/python3.6/site-packages/putio_automator/commands/init.py", line 8, in import putio_automator.commands.torrents File "/home/zerith/.local/lib/python3.6/site-packages/putio_automator/commands/torrents.py", line 12, in from fswatch import Monitor File "/home/zerith/.local/lib/python3.6/site-packages/fswatch/init.py", line 2, in from .fswatch import Monitor File "/home/zerith/.local/lib/python3.6/site-packages/fswatch/fswatch.py", line 4, in from fswatch import libfswatch File "/home/zerith/.local/lib/python3.6/site-packages/fswatch/libfswatch.py", line 9, in fsw_init_library = lib.fsw_init_library File "/usr/lib/python3.6/ctypes/init.py", line 361, in getattr func = self.getitem(name) File "/usr/lib/python3.6/ctypes/init.py", line 366, in getitem func = self._FuncPtr((name_or_ordinal, self)) AttributeError: /usr/bin/python3: undefined symbol: fsw_init_library

Any idea why this will happen?

ZerithZA commented 3 years ago

I've also tried to install under Python 2.7 but cannot find fswatch.

~$ pip2.7 install --user putio-automator DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. Collecting putio-automator Using cached putio-automator-2.0.0.tar.gz (12 kB) Collecting appdirs Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB) Collecting click Using cached click-7.1.2-py2.py3-none-any.whl (82 kB) Collecting click-log Using cached click_log-0.3.2-py2.py3-none-any.whl (4.6 kB) ERROR: Could not find a version that satisfies the requirement fswatch (from putio-automator) (from versions: none) ERROR: No matching distribution found for fswatch (from putio-automator) WARNING: You are using pip version 20.3.4; however, version 21.2.4 is available. You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.

datashaman commented 3 years ago

I'll need to rethink this choice - it looks like you need an OS package in addition to the python one.

Run apt install fswatch, then try again. If that works, awesome.

I will look for an alternative solution that doesn't require an OS package to support it. 🤞🏼

ZerithZA commented 3 years ago

Hi, I initially did manually try to install both fs-watch and fswatch to see if either worked but neither did. I also tried via apt and made no difference.

nuc:/mnt/files/downloads/putio$ sudo apt install fswatch
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libfswatch9
The following NEW packages will be installed:
  fswatch libfswatch9
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 166 kB of archives.
After this operation, 526 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://za.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libfswatch9 amd64 1.11.2+repack-10ubuntu0.1 [93.7 kB]
Get:2 http://za.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 fswatch amd64 1.11.2+repack-10ubuntu0.1 [72.0 kB]
Fetched 166 kB in 1s (280 kB/s)
Selecting previously unselected package libfswatch9.
(Reading database ... 188863 files and directories currently installed.)
Preparing to unpack .../libfswatch9_1.11.2+repack-10ubuntu0.1_amd64.deb ...
Unpacking libfswatch9 (1.11.2+repack-10ubuntu0.1) ...
Selecting previously unselected package fswatch.
Preparing to unpack .../fswatch_1.11.2+repack-10ubuntu0.1_amd64.deb ...
Unpacking fswatch (1.11.2+repack-10ubuntu0.1) ...
Setting up libfswatch9 (1.11.2+repack-10ubuntu0.1) ...
Setting up fswatch (1.11.2+repack-10ubuntu0.1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for install-info (6.5.0.dfsg.1-2) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
nuc:/mnt/files/downloads/putio$ pip2.7 install --user putio-automator
/usr/lib/python2.7/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.utils import int_from_bytes
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting putio-automator
  Using cached putio-automator-2.0.0.tar.gz (12 kB)
Collecting appdirs
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Requirement already satisfied: click in /usr/local/lib/python2.7/dist-packages (from putio-automator) (7.1.2)
Collecting click-log
  Using cached click_log-0.3.2-py2.py3-none-any.whl (4.6 kB)
ERROR: Could not find a version that satisfies the requirement fswatch (from putio-automator) (from versions: none)
ERROR: No matching distribution found for fswatch (from putio-automator)
datashaman commented 3 years ago

python 2.7 won't work at all.

ZerithZA commented 3 years ago

I tried with pip 21.2.4 (python 3.6) and get the following.

@nuc:~$ putio config init Traceback (most recent call last): File "/home/**/.local/bin/putio", line 5, in <module> from putio_automator.cli import main File "/home/**/.local/lib/python3.6/site-packages/putio_automator/cli.py", line 34, in <module> from . import commands File "/home/**/.local/lib/python3.6/site-packages/putio_automator/commands/__init__.py", line 8, in <module> import putio_automator.commands.torrents File "/home/**/.local/lib/python3.6/site-packages/putio_automator/commands/torrents.py", line 12, in <module> from fswatch import Monitor File "/home/**/.local/lib/python3.6/site-packages/fswatch/__init__.py", line 2, in <module> from .fswatch import Monitor File "/home/**/.local/lib/python3.6/site-packages/fswatch/fswatch.py", line 4, in <module> from fswatch import libfswatch File "/home/**/.local/lib/python3.6/site-packages/fswatch/libfswatch.py", line 9, in <module> fsw_init_library = lib.fsw_init_library File "/usr/lib/python3.6/ctypes/__init__.py", line 361, in __getattr__ func = self.__getitem__(name) File "/usr/lib/python3.6/ctypes/__init__.py", line 366, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: /usr/bin/python3: undefined symbol: fsw_init_library

datashaman commented 3 years ago

I'll write something that splits the handling depending on operating system. This was added mostly for the benefit of Mac users, the previous inotify-based solution worked fine for UNIX OSes.

datashaman commented 3 years ago

Can you try this with the more recent LTS? 18.04 is quite old now.

ZerithZA commented 3 years ago

Some other stuff I have installed is dependant on LTS 18.04. I can see if I can set it up from docker and mount the volumes accordingly.

datashaman commented 3 years ago

I'll have a hotfix out by the end of the day for this. I'll use some ducktyping and mix the two approaches depending on OS.

ZerithZA commented 3 years ago

Awesome, thanks.

datashaman commented 3 years ago

Would you mind seeing if this release works for you? https://pypi.org/project/putio-automator/2.0.1.dev4/

Install with:

pip install --user putio-automator==2.0.1.dev4
ZerithZA commented 3 years ago

I installed it as requested and installation worked as expected and I was able to run the init command.

I then created an application with some dummy data in putio in order to get the OAuth token which I supplied during the init process but when I run the account info command I get the following error "The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.". Any idea why?

ZerithZA commented 3 years ago

I see other issue logged says that you need to install locally and not globally, I assume this is in regards to the --user tag on install which I have done?

datashaman commented 3 years ago

yes, you must use --user option when installing.

datashaman commented 3 years ago

find which config file is being used with:

putio config show

then verify the contents of the file are correct.

if you are always executing this from a specific folder, you can override the config with a .env file with the appropriate values in it.

datashaman commented 3 years ago

use which putio to figure out which binary you are executing. it should be in ~/.local/bin for ubuntu i think.

if it is in another location, it's likely from a system-wide installation. try uninstalling that first.

datashaman commented 3 years ago

hmm, there is another issue with finding the config, i think. I'll investigate.

ZerithZA commented 3 years ago
zerith@nuc:~$ putio config show
Searching /home/zerith/config.py
Searching /home/zerith/.local/share/putio-automator/config.py
Found config file at /home/zerith/.local/share/putio-automator/config.py
zerith@nuc:~$ which putio
/home/zerith/.local/bin/putio
ZerithZA commented 3 years ago

The content of the config file is showing what I specified during the init process.

datashaman commented 3 years ago

Please install this new release and try again.

https://pypi.org/project/putio-automator/2.0.1.dev5/

Install with:

pip install --user putio-automator==2.0.1.dev5
ZerithZA commented 3 years ago

That fixed the issue.

Could run the following commands without any issues: putio config show putio files list putio transfers list

ZerithZA commented 3 years ago

Thanks for all the effort.

datashaman commented 3 years ago

Whoot! 🎉

I've got a few more small things to add to this then I'll release it - probably as 2.1.0 since it'll contain some new things as well as bugfixes.

Thanks for helping me find some pretty obvious omissions from the new release!