Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropbox raise exception when trying to upload a file #3

Open
edvm opened this issue Jul 24, 2017 · 15 comments
Open

Dropbox raise exception when trying to upload a file #3

edvm opened this issue Jul 24, 2017 · 15 comments

Comments

@edvm
Copy link
Contributor

edvm commented Jul 24, 2017

When i save a file on DROSH_SCREENSHOT_FOLDER i got the following exception on console:
(drosh) @math:drosh(master) $ export DROSH_SCREENSHOT_FOLDER=/home/edvm/Pictures/Screenshots/ (drosh) @math:drosh(master) $ export DROSH_DROPBOX_TOKEN=xxx (drosh) @math:drosh(master) $ export DROSH_DROPBOX_FOLDER=Drosh (drosh) @math:drosh(master) $ python src/drosh.py 2017-07-24 12:05:05,137 - __main__ - DEBUG - WD=(1) MASK=(256) COOKIE=(0) LEN=(16) MASK->NAMES=['IN_CREATE'] WATCH-PATH=[/home/edvm/Pictures/Screenshots/] FILENAME=[foo2.png] 2017-07-24 12:05:05,138 - __main__ - INFO - Create shared link for: b'foo2.png' 2017-07-24 12:05:05,139 - __main__ - ERROR - Trying 0 time: Error to create shared link ValidationError("'Drosh/foo2.png' did not match pattern '(/(.|[\\r\\n])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?)'") 2017-07-24 12:05:05,140 - __main__ - ERROR - Trying 1 time: Error to create shared link ValidationError("'Drosh/foo2.png' did not match pattern '(/(.|[\\r\\n])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?)'")

@jcarizza
Copy link
Owner

Thankyou for reporting.

You have to check DROSH_SCREENSHOT_FOLDER exists inside your dropbox folders and you must have Dropbox installed and running.

We discussed offline and its resolved.

@edvm
Copy link
Contributor Author

edvm commented Jul 25, 2017

Following your advice @jcarizza

1- I installed Dropbox daemon on my computer
2- Created a 'Screenshots' directory inside Dropbpx dir (/home/edvm/Dropbox/Screenshots)
3- Configured DROSH_DROPBOX_FOLDER=/home/edvm/Dropbox/Screenshots

When saving a screenshot to DROSH_SCREENSHOT_FOLDER (which points to DROSH_SCREENSHOT_FOLDER=/home/edvm/Pictures/Screenshots/) i got the following error:

(drosh) @math:drosh(master) $ python src/drosh.py 2017-07-25 12:29:41,791 - __main__ - DEBUG - WD=(1) MASK=(256) COOKIE=(0) LEN=(16) MASK->NAMES=['IN_CREATE'] WATCH-PATH=[/home/edvm/Pictures/Screenshots/] FILENAME=[bar2.png] 2017-07-25 12:29:41,792 - __main__ - INFO - Create shared link for: b'bar2.png' 2017-07-25 12:29:42,956 - __main__ - ERROR - Trying 0 time: Error to create shared link ApiError('xxx', CreateSharedLinkWithSettingsError('path', LookupError('not_found', None))) 2017-07-25 12:29:43,571 - __main__ - ERROR - Trying 1 time: Error to create shared link ApiError('yyy', CreateSharedLinkWithSettingsError('path', LookupError('not_found', None))) ^CTraceback (most recent call last): File "src/drosh.py", line 67, in create_shared_link settings=None File "/home/edvm/.virtualenvs/drosh/lib/python3.5/site-packages/dropbox/base.py", line 2120, in sharing_create_shared_link_with_settings None, File "/home/edvm/.virtualenvs/drosh/lib/python3.5/site-packages/dropbox/dropbox.py", line 256, in request user_message_locale) dropbox.exceptions.ApiError: ApiError('hhh', CreateSharedLinkWithSettingsError('path', LookupError('not_found', None)))

Any hints? Thanks in advance,

@jcarizza
Copy link
Owner

Just to make sure.

The DROSH_SCREENSHOT_FOLDER is the full path in your computer where you save the screenshots. This folder must be one of the sub-folders where you have configured Dropbox. Let's say you configured dropbox in /home/user/Dropbox and you created a Capturas folder inside your dropbox folder so the path should be the join of /home/user/Dropbox and /Capturas .In this case /home/user/Dropbox/Capturas, or in your case DROSH_SCREENSHOT_FOLDER=/home/edvm/Dropbox/Screenshots

The DROSH_DROPBOX_FOLDER is the relative path in your dropbox folder in the cloud. I created the Capturas folder inside Dropbox folder so in the cloud the path for the Capturas folder is in the root /Capturas in your case DROSH_DROPBOX_FOLDER=/Screenshots

@jcarizza jcarizza reopened this Jul 26, 2017
@zamoroka
Copy link
Contributor

@edvm @jcarizza
got the same error. please help to resolve. Thanks in advance.

echo $DROSH_SCREENSHOT_FOLDER
/home/zamoroka/Pictures/screens

echo $DROSH_DROPBOX_FOLDER
/screens

screen1
screen2

@jcarizza
Copy link
Owner

jcarizza commented May 16, 2018

Hello @zamoroka

You can use the same token you use in Drosh to explore paths with the Dropbox API Explorer. https://dropbox.github.io/dropbox-api-v2-explorer/#files_list_folder .

I'm seeing that an item has two path names path_lower and path_display.
https://www.dropbox.com/s/8tguvax4mjhh7l4/Selecci%C3%B3n_169.png?dl=0

In my DROSH_DROPBOX_FOLDER i've configured the path_display name https://www.dropbox.com/s/xk6gz2ht8dsb5yb/Selecci%C3%B3n_170.png?dl=0

@edvm maybe the problem is that we should to set the path_display that is capitalized

@jcarizza jcarizza reopened this May 16, 2018
@jcarizza
Copy link
Owner

@zamoroka did work?

@zamoroka
Copy link
Contributor

@jcarizza
yes, I resolved the issue.
local folder should synchronize with dropbox. I thouth, that your script uploads automatically.
sorry if I've wasted your time and thanks :)

@zamoroka
Copy link
Contributor

@jcarizza
also it don't show the notification, when configured via supervisor.service. Could you please suggest how to configure supervisor? I think that script sends notification to wrong display or user, but I cant figure out how to resolve this.
Thanks

@jcarizza
Copy link
Owner

jcarizza commented May 17, 2018

@zamoroka

You can look your default display on the terminal printing the DISPLAY variable that is the X display name

My DISPLAY output is:

jcarizza@fox ~ $ echo $DISPLAY
:0

This is my drosh.conf supervisor file:

[program:drosh]
command=/home/jcarizza/.env/drosh/bin/python /usr/local/bin/drosh.py
user=jcarizza
autostart=true
autorestart=true
stderr_logfile=/var/log/drosh.log
stdout_logfile=/var/log/drosh.log
environment=DISPLAY=":0.0",DROSH_DROPBOX_TOKEN='***********************',DROSH_DROPBOX_FOLDER='/Capturas',DROSH_SCREENSHOT_FOLDER='/home/jcarizza/Dropbox/Capturas',USER=jcarizza,HOME=/home/jcarizza,LOGNAME=jcarizza

@zamoroka
Copy link
Contributor

@jcarizza
the same configuration.
ok. no worries. I'll try to figure out and inform you if find something

@jcarizza
Copy link
Owner

@zamoroka what operative system and windows manager are using you? I will investigete too

@zamoroka
Copy link
Contributor

zamoroka commented May 17, 2018

@jcarizza
Ubuntu 16.04.4 LTS with Unity

steps for supervisor:

sudo apt install supervisor
cp supervisor/drosh.conf /etc/supervisor/conf.d/drosh.conf
supervisorctl reread
supervisorctl update
sudo /etc/init.d/supervisor restart

supervisorctl shows:

drosh                            RUNNING   pid 1614, uptime 0:35:18
supervisor> 

script works, I have link in clipboard, just without any notification.

@zamoroka
Copy link
Contributor

@jcarizza
I've added

DBUS_SESSION_BUS_ADDRESS='unix:abstract=/tmp/dbus-YMTbwfuw2F' 

to environment in drosh.conf supervisor file
and it works now
but /tmp/dbus-YMTbwfuw2F is temporary value so need to investigate further

@jcarizza
Copy link
Owner

I'm looking pyperclip source code, they also use de DISPLAY https://github.com/asweigart/pyperclip/blob/master/pyperclip/__init__.py#L60

@zamoroka
Copy link
Contributor

@jcarizza
I've changed user to root in drosh.conf supervisor file and it fixes notification display.
possibly some wrong configuration of supervisor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants