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

Issue with automatic start #11

Closed
Sh00by opened this issue Nov 1, 2016 · 3 comments
Closed

Issue with automatic start #11

Sh00by opened this issue Nov 1, 2016 · 3 comments

Comments

@Sh00by
Copy link

Sh00by commented Nov 1, 2016

Hi,

The scripts works properly by manually using it. But I'm having an issue with automatic start (using /usr/local/etc/rc.d/ or the syno Scheduled Task) and I'm not enough skilled in Python to understand what's wrong....

File "/volume1/homes/admin/mediamon.py", line 134, in <module>
    exclude_filter=lambda p: '/@' in p
  File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/pyinotify.py", line 1916, in add_watch
    exclude_filter)
  File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/pyinotify.py", line 1833, in __add_watch
    wd = self._inotify_wrapper.inotify_add_watch(self._fd, path, mask)
  File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/pyinotify.py", line 153, in inotify_add_watch
    return self._inotify_add_watch(fd, pathname, mask)
  File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/pyinotify.py", line 246, in _inotify_add_watch
    pathname = pathname.encode(sys.getfilesystemencoding())
UnicodeEncodeError: 'ascii' codec can't encode characters in position 42-43: ordinal not in range(128)

By the way, on my Syno I have both python 2.7 (for another app) and python 3.
Model DS214play / FW : DSM 6.0.2-8451 Update 2

@carljm
Copy link
Owner

carljm commented Nov 9, 2016

Where do you see this error traceback?

@Sh00by
Copy link
Author

Sh00by commented Nov 10, 2016

I activated the mail notification in the syno task scheduler (for launching the script) when starting or shutdowning the syno. This is the only way I found to get logs

@Sh00by Sh00by closed this as completed Nov 10, 2016
@Sh00by Sh00by reopened this Nov 10, 2016
@Sh00by
Copy link
Author

Sh00by commented Nov 19, 2016

Ok, I found the issue ... I don't know why really.....Probably because I have files/ folder with accent..
Found it from the original post https://codesourcery.wordpress.com/2012/11/29/more-on-the-synology-nas-automatically-indexing-new-files/

Vincent Barberet
April 28, 2016 at 9:44 pm
Well, I’ve found a dirty workaround.
The issue is that I have some filenames that are not UTF-8 encoded, but my filesystem is UTF-8 (use python command “sys.getfilesystemencoding()” to get your filesystem encoding).
So, the real issue is that I have bad filenames. As I cannot fix easily those filenames, I have to live with them.

Here is what I did:
in /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/pyinotify.py, line 246:
I have put:
pathname = pathname.encode(sys.getfilesystemencoding(), ‘surrogateescape’)
instead of
pathname = pathname.encode(sys.getfilesystemencoding())

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

2 participants