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

Setup fails on OpenBSD #703

Open
vext01 opened this issue Nov 21, 2017 · 5 comments
Open

Setup fails on OpenBSD #703

vext01 opened this issue Nov 21, 2017 · 5 comments

Comments

@vext01
Copy link

vext01 commented Nov 21, 2017

Hi,

I have the following when running setup on OpenBSD-6.2 with Python-3.6:

$ python3.6 /home/cherrymusic/.local/bin/cherrymusic --setup  --port 9090 
Traceback (most recent call last):
  File "/home/cherrymusic/.local/bin/cherrymusic", line 33, in <module>
    import cherrymusicserver
  File "/home/cherrymusic/.local/lib/python3.6/site-packages/cherrymusicserver/__init__.py", line 64, in <module>
    gettext.install('default', localedir=pathprovider.getResourcePath('res/i18n'))
  File "/home/cherrymusic/.local/lib/python3.6/site-packages/cherrymusicserver/pathprovider.py", line 166, in getResourcePath
    "Couldn't locate {path!r} in any {res!r}!".format(path=path, res=RESOURCE_PATHS)
cherrymusicserver.pathprovider.ResourceNotFound: "Couldn't locate 'res/i18n' in any ['/home/cherrymusic/.local/lib/python3.6/site-packages', '/home/cherrymusic/.cherrymusic']!"

Any ideas?

@rjsberry
Copy link
Contributor

Did you install via pip or git clone?

Looking at the source for getResourcePath I would have thought L151 could be to blame. Maybe we need an isBSD function in pathprovider.

def getResourcePath(path):
RESOURCE_PATHS = []
if isLinux():
# check share first
RESOURCE_PATHS.append(os.path.join(sys.prefix, 'share', sharedFolderName))
# otherwise check local/share
RESOURCE_PATHS.append(os.path.join(sys.prefix, 'local', 'share', sharedFolderName))
# otherwise check local install
RESOURCE_PATHS.append(os.path.dirname(os.path.dirname(__file__)))
# lastly check homedir
RESOURCE_PATHS.append(getUserDataPath())

Please post the output of:

find / -type d -regex ".*i18n\/res" 2>/dev/null

@vext01
Copy link
Author

vext01 commented Aug 5, 2018

Revisiting this:

$ /home/cherry/.local/bin/cherrymusic --setup                 
Traceback (most recent call last):
  File "/home/cherry/.local/bin/cherrymusic", line 33, in <module>
    import cherrymusicserver
  File "/home/cherry/.local/lib/python3.6/site-packages/cherrymusicserver/__init__.py", line 64, in <module>
    gettext.install('default', localedir=pathprovider.getResourcePath('res/i18n'))
  File "/home/cherry/.local/lib/python3.6/site-packages/cherrymusicserver/pathprovider.py", line 166, in getResourcePath
    "Couldn't locate {path!r} in any {res!r}!".format(path=path, res=RESOURCE_PATHS)
cherrymusicserver.pathprovider.ResourceNotFound: "Couldn't locate 'res/i18n' in any ['/home/cherry/.local/lib/python3.6/site-packages', '/home/cherry/.cherrymusic']!"

OpenBSD's find doesn't support regex, but we can do:

$ find / -type d -name "*i18n*" 2> /dev/null
/home/cherry/.local/share/cherrymusic/res/i18n
$

I guess that's not what you were expecting?

Here's the problem:

def getResourcePath(path):
    RESOURCE_PATHS = []
    if isLinux():
        # check share first
        RESOURCE_PATHS.append(os.path.join(sys.prefix, 'share', sharedFolderName))

You probably want to look there on all UNIX like platforms. I hacked isLinux and it gets further:

$ /home/cherry/.local/bin/cherrymusic --setup                                                                             
[180805-19:55] Migrating saved album art filenames...
[180805-19:55] Album art filename migration done.

Starting setup server on port 8080 ...
Open your browser and put the server IP:8080 in the address bar.
If you run the server locally, use: localhost:8080.

Traceback (most recent call last):
  File "/home/cherry/.local/bin/cherrymusic", line 198, in <module>
    browsersetup.configureAndStartCherryPy(port) # blocks until config saved
  File "/home/cherry/.local/lib/python3.6/site-packages/cherrymusicserver/browsersetup.py", line 166, in configureAndStartCherryPy                                                
    cherrypy.engine.timeout_monitor.frequency = 1
AttributeError: 'Bus' object has no attribute 'timeout_monitor'

@devsnd
Copy link
Owner

devsnd commented Aug 5, 2018

Hey @vext01,

Please use the devel branch, the problem with the timeout monitor should have been fixed there already

@vext01
Copy link
Author

vext01 commented Aug 6, 2018

I confirm that the devel branch works, but I'm not sure why the isLinux hack isn't required there. Perhaps the result is cached from when I fixed the version from pip?

@vext01
Copy link
Author

vext01 commented Aug 15, 2018

So, what about the isLinux hack? How about rename it to isUnix or have a isBSD and adjust call sites?

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

No branches or pull requests

4 participants