xybu / onedrive-d-old

Microsoft OneDrive client on Linux.
http://xybu.me/projects/onedrive-d/
GNU Lesser General Public License v3.0
820 stars 143 forks source link

Running with Python < 3.4 #118

Closed vk5ztv closed 9 years ago

vk5ztv commented 9 years ago

Hi. I've just installed onedrive-d on openSuSE 13.1. The install appeared to complete successfully (no errors reported), the cli config worked and it successfully authenticated with OneDrive. Running "onedrive-d" from the command line fails, however, producing the following output:

[2015-02-26 22:46:36,773] DEBUG: thread_mgr: started. [2015-02-26 22:46:36,774] DEBUG: MainThread: daemon started. Traceback (most recent call last): File "/usr/bin/onedrive-d", line 9, in load_entry_point('onedrive-d==1.0.0.dev0', 'console_scripts', 'onedrive-d')() File "/usr/lib/python3.3/site-packages/onedrive_d-1.0.0.dev0-py3.3.egg/onedrive_d/od_main.py", line 45, in main File "/usr/lib/python3.3/site-packages/onedrive_d-1.0.0.dev0-py3.3.egg/onedrive_d/od_daemon_cli.py", line 113, in start File "/usr/lib/python3.3/site-packages/onedrive_d-1.0.0.dev0-py3.3.egg/onedrive_d/od_daemon_cli.py", line 53, in create_workers File "/usr/lib/python3.3/site-packages/onedrive_d-1.0.0.dev0-py3.3.egg/onedrive_d/od_sqlite.py", line 35, in init TypeError: 'uri' is an invalid keyword argument for this function [2015-02-26 22:46:38,668] DEBUG: Dummy-2: cleaning up.

python3 --version: Python 3.3.5

python3-pip is installed.

I also get a very similar error after installing on a Raspberry Pi running Raspian/python 3.2.3, however that seems to give some additional detail;

[2015-02-26 22:50:35,394] DEBUG: MainThread: daemon started. [2015-02-26 22:50:35,407] DEBUG: thread_mgr: started. Traceback (most recent call last): File "/usr/local/bin/onedrive-d", line 9, in load_entry_point('onedrive-d==1.0.0dev', 'console_scripts', 'onedrive-d')() File "/usr/local/lib/python3.2/dist-packages/onedrive_d-1.0.0dev-py3.2.egg/onedrive_d/od_main.py", line 45, in main daemon.start() File "/usr/local/lib/python3.2/dist-packages/onedrive_d-1.0.0dev-py3.2.egg/onedrive_d/od_daemon_cli.py", line 113, in start self.create_workers() File "/usr/local/lib/python3.2/dist-packages/onedrive_d-1.0.0dev-py3.2.egg/onedrive_d/od_daemon_cli.py", line 53, in create_workers self.taskmgr = od_sqlite.TaskManager() File "/usr/local/lib/python3.2/dist-packages/onedrive_d-1.0.0dev-py3.2.egg/onedrive_d/od_sqlite.py", line 35, in init self.conn = sqlite3.connect('file::memory:?mode=memory&cache=shared', isolation_level = None, uri=True) TypeError: 'uri' is an invalid keyword argument for this function [2015-02-26 22:50:37,411] DEBUG: Dummy-2: cleaning up.

vk5ztv commented 9 years ago

I have confirmed that removing uri=True from line 35 of od_sqlite.py allows the daemon to start and run successfully on Raspian. It is currently syncing. :)

The same also works on openSuSE 13.1.

vk5ztv commented 9 years ago

Now all I need to do is get it to run as a service on both. Relatively easy on Raspbian (no Systemd there yet) but creating a Systemd unit file is not something I've played with yet on openSuSE.

xybu commented 9 years ago

The uri parameter makes sure the database is created in memory not hard drive. I worry that without it the task queue database is created somewhere in the disk.

Sent from my Windows Phone


From: vk5ztvmailto:notifications@github.com Sent: ‎2/‎26/‎2015 7:57 AM To: xybu/onedrive-dmailto:onedrive-d@noreply.github.com Subject: Re: [onedrive-d] Installed successfully on openSuSE 13.1 but won't run (#118)

Now all I need to do is get it to run as a service on both. Relatively easy on Raspbian (no Systemd there yet) but creating a Systemd unit file is not something I've played with yet on openSuSE.


Reply to this email directly or view it on GitHub: https://github.com/xybu/onedrive-d/issues/118#issuecomment-76173477

xybu commented 9 years ago

I checked the Python3 sqlite3 API. The param uri is for only Python 3.4 and above. Let me figure out a solution for it.

I also checked that if I drop the uri, a file called "file::memory:?mode=memory&cache=shared" will be generated in current working directory.

xybu commented 9 years ago

Pushed something new. Please see if it works. You might need to run the setup script (python3 setup.py install) more than once if you have installed it to your system before.

vk5ztv commented 9 years ago

Oops. Build failed. Did a git pull (after stashing my local changes removing the uri parameter) and got this:

python3 ./setup.py install Traceback (most recent call last): File "./setup.py", line 5, in from pip.req import parse_requirements File "/usr/lib/python3.3/site-packages/pip/init.py", line 11, in from pip.vcs import git, mercurial, subversion, bazaar # noqa File "/usr/lib/python3.3/site-packages/pip/vcs/mercurial.py", line 9, in from pip.download import path_to_url2 File "/usr/lib/python3.3/site-packages/pip/download.py", line 147, in class VerifiedHTTPSHandler(urllib.request.HTTPSHandler): AttributeError: 'module' object has no attribute 'request'

(This is on openSuSE 13.1)

vk5ztv commented 9 years ago

On the Raspberry Pi (Raspian) I get this error after a git pull...

sudo python3 ./setup.py install Traceback (most recent call last): File "./setup.py", line 14, in requirements = [str(r.req) for r in requirements] File "./setup.py", line 14, in requirements = [str(r.req) for r in requirements] File "/usr/lib/python3/dist-packages/pip/req.py", line 1240, in parse_requirements skip_regex = options.skip_requirements_regex AttributeError: 'NoneType' object has no attribute 'skip_requirements_regex'

This one is running python 3.2, whereas openSuSE is python 3.3.

xybu commented 9 years ago

To confirm, did the program work when there was no "requirements.txt" but no longer works now?

Sent from my Windows Phone


From: vk5ztvmailto:notifications@github.com Sent: ‎2/‎27/‎2015 6:06 AM To: xybu/onedrive-dmailto:onedrive-d@noreply.github.com Cc: Xiangyu Bumailto:xybu92@live.com Subject: Re: [onedrive-d] Running with Python < 3.4 (#118)

On the Raspberry Pi (Raspian) I get this error after a git pull...

sudo python3 ./setup.py install Traceback (most recent call last): File "./setup.py", line 14, in requirements = [str(r.req) for r in requirements] File "./setup.py", line 14, in requirements = [str(r.req) for r in requirements] File "/usr/lib/python3/dist-packages/pip/req.py", line 1240, in parse_requirements skip_regex = options.skip_requirements_regex AttributeError: 'NoneType' object has no attribute 'skip_requirements_regex'

This one is running python 3.2, whereas openSuSE is python 3.3.


Reply to this email directly or view it on GitHub: https://github.com/xybu/onedrive-d/issues/118#issuecomment-76377430

xybu commented 9 years ago

Sounds like an issue with the merge about pep8 (the last commit on future branch when I reply this). Did the commit before this one work for you?

Sent from my Windows Phone


From: vk5ztvmailto:notifications@github.com Sent: ‎2/‎27/‎2015 5:58 AM To: xybu/onedrive-dmailto:onedrive-d@noreply.github.com Cc: Xiangyu Bumailto:xybu92@live.com Subject: Re: [onedrive-d] Running with Python < 3.4 (#118)

Oops. Build failed. Did a git pull (after stashing my local changes removing the uri parameter) and got this:

python3 ./setup.py install Traceback (most recent call last): File "./setup.py", line 5, in from pip.req import parse_requirements File "/usr/lib/python3.3/site-packages/pip/init.py", line 11, in from pip.vcs import git, mercurial, subversion, bazaar # noqa File "/usr/lib/python3.3/site-packages/pip/vcs/mercurial.py", line 9, in from pip.download import path_to_url2 File "/usr/lib/python3.3/site-packages/pip/download.py", line 147, in class VerifiedHTTPSHandler(urllib.request.HTTPSHandler): AttributeError: 'module' object has no attribute 'request'


Reply to this email directly or view it on GitHub: https://github.com/xybu/onedrive-d/issues/118#issuecomment-76376526

vk5ztv commented 9 years ago

Yes, I had it working on both openSuSE 13.1 and Raspian, with 1.0-dev and the uri parameter removed. I did not get to try the previous commit on future branch. What parameters should I give to git to try the current version -1? I'm a relative newbie when it comes to git. Since I did a 'pip3 uninstall onedrive-d' on Raspbian, I can't even seem to get back to my working version. Oh well. I do still have the working version installed on openSuSE, so I'm not totally lost yet. :)

vk5ztv commented 9 years ago

It's getting late here (Australia), so I won't be doing any more testing tonight. It will probably be Sunday before I get to re-test. Thanks for your efforts, btw, it is a great help to have access to OneDrive direct from the Linux desktop without having to start Windows in a VM. :)

xybu commented 9 years ago

Could you check if it solves the problem by, in setup.py, deleting the lines

requirements = parse_requirements('requirements.txt')
requirements = [str(r.req) for r in requirements]

and changing the line

install_requires=requirements,

to

install_requires = ['requests', 'urllib3', 'certifi', 'send2trash'],

as a partial revert of commit b4a9ef7925efb78a87d02a14631ef7fabb0b1039?

The exception you encountered is a known issue for python3-pip < 1.1.

xybu commented 9 years ago

I have made the changes in future-daemon branch. You could check it out and see how things go. The setup script no longer depends on pip.

vk5ztv commented 9 years ago

I've made the changes and tested them. I also had to delete the line requiring pip.req. After removing the pip.req line and making the requirements changes, I have the future branch built and running successfully on both Raspian and openSuSE 13.1.

I can't yet figure out how to check-out future-daemon and build that instead. Can you give me a hint of what git commands to use to do that, please?

xybu commented 9 years ago

git checkout future-daemon?

vk5ztv commented 9 years ago

Thanks. I don't know why it didn't work before, but I've got it now, built and working - daemonised (on openSuSE 13.1). I haven't yet tried it on the Raspberry Pi - it's getting late so that will be for another night.

Some feedback; I had problems running 'python3 ./setup.py install'. For some reason, even though I had daemonocle installed via easy_install (sym-linked to easy_install-3.3), every time setup.py was run like that it generated errors. I could reproduce the error exactly by running easy_install-2.7 (which uses pysetuptools 0.9.8). OK - so something is screwy running the installer that way.

I tried running install.sh, but kept getting, "Error: setup script does not support your distro token..." followed by gibberish. It seems that the output of lsb-release on openSuSE is not what the install script expects. On the other hand, os-release works perfectly, so by modifying the install script as follows, I was able to make it run and install properly with no errors.

#if [ -f "$LSB_RELEASE_BIN" ] ; then # DISTRIB_ID=$(grep 'DISTRIB_ID=' $LSB_RELEASE_BIN | cut -d'=' -f2) if [ -f "$OS_RELEASE_BIN" ] ; then DISTRIB_ID=$(grep '^ID=' $OS_RELEASE_BIN | cut -d'=' -f2) else echo -e "\033[31mError: Could not determine your OS distribution.\e[0m" exit 1 fi

The full output of lsb-release on openSuSE 13.1:

LSB Version: core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch

Nowhere does it contain the distribution name. :(

Great work so far! Thanks for your efforts. :)

vk5ztv commented 9 years ago

Couldn't resist - after adding raspbian to the tokens for debian-type os's install.sh ran and it built and installed without errors on the RPi. It is now running daemonised there too. I'll submit a patch for install.sh in a separate issue.