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

Headphones Fails to Start #1913

Closed
eangulus opened this issue Sep 24, 2014 · 23 comments
Closed

Headphones Fails to Start #1913

eangulus opened this issue Sep 24, 2014 · 23 comments

Comments

@eangulus
Copy link

Running Ubuntu Server 14.04 Fully upto date including headphones git.

Get the following error when typing python heandphones.py

Traceback (most recent call last):
File "Headphones.py", line 22, in
from headphones import webstart, logger
File "/home/karen/.headphones/headphones/init.py", line 30, in
from headphones import versioncheck, logger, version
File "/home/karen/.headphones/headphones/versioncheck.py", line 23, in
from headphones import logger, version, request
File "/home/karen/.headphones/headphones/logger.py", line 16, in
from headphones import helpers
File "/home/karen/.headphones/headphones/helpers.py", line 26, in
from beets.mediafile import MediaFile, FileTypeError, UnreadableFileError
File "lib/beets/init.py", line 22, in
import beets.library
File "lib/beets/library.py", line 24, in
from unidecode import unidecode
ImportError: cannot import name unidecode

@basilfx
Copy link
Contributor

basilfx commented Sep 24, 2014

Strange. I run Headphones under 14.04 too, and it works.

Could you try the following: cd to the headphones lib/ folder. Then spawn a python shell and type: import unidecode.

@basilfx
Copy link
Contributor

basilfx commented Sep 25, 2014

I can confirm the current develop branch works as expected. I cannot reproduce the bug.

Possible causes:

  • missing files (corrupted clone?)
  • old *.pyc files

@eangulus
Copy link
Author

Did the import thing.

still get this:

karen@SERVER-KARRAWA:~/.headphones$ python Headphones.py
Traceback (most recent call last):
File "Headphones.py", line 22, in
from headphones import webstart, logger
File "/home/karen/.headphones/headphones/init.py", line 30, in
from headphones import versioncheck, logger, version
File "/home/karen/.headphones/headphones/versioncheck.py", line 23, in
from headphones import logger, version, request
File "/home/karen/.headphones/headphones/logger.py", line 16, in
from headphones import helpers
File "/home/karen/.headphones/headphones/helpers.py", line 26, in
from beets.mediafile import MediaFile, FileTypeError, UnreadableFileError
File "lib/beets/init.py", line 22, in
import beets.library
File "lib/beets/library.py", line 24, in
from unidecode import unidecode
ImportError: cannot import name unidecode

@eangulus
Copy link
Author

I am happy to reinstall this, but don't want to loose the database. What files do I need to keep?

@eangulus
Copy link
Author

Also happy for you to remote login and see for yourself.

@basilfx
Copy link
Contributor

basilfx commented Sep 25, 2014

Well, if all is OK, you should have a file called ROOT/lib/unidecode/__init__.py. It should not be empty.

If you want to do a reinstall, please check the Troubleshooting wiki, under auto update section.

@eangulus
Copy link
Author

I have the file. Contents are:

-- coding: utf-8 --

"""Transliterate Unicode text into plain 7-bit ASCII.

Example usage:

from unidecode import unidecode:
unidecode(u"\u5317\u4EB0")
"Bei Jing "

The transliteration uses a straightforward map, and doesn't have alternatives
for the same character based on language, position, or anything else.

In Python 3, a standard string object will be returned. If you need bytes, use:

unidecode("Κνωσός").encode("ascii")
b'Knosos'
"""
import warnings
from sys import version_info

Cache = {}

def unidecode(string):
"""Transliterate an Unicode object into an ASCII string

>>> unidecode(u"\u5317\u4EB0")
"Bei Jing "
"""

if version_info[0] < 3 and not isinstance(string, unicode):
    warnings.warn(  "Argument %r is not an unicode object. "
                    "Passing an encoded string will likely have "
                    "unexpected results." % (type(string),),
        RuntimeWarning, 2)

retval = []

for char in string:
    codepoint = ord(char)

    if codepoint < 0x80: # Basic ASCII
        retval.append(str(char))
        continue

    if codepoint > 0xeffff:
        continue # Characters in Private Use Area and above are ignored

    section = codepoint >> 8   # Chop off the last two hex digits
    position = codepoint % 256 # Last two hex digits

    try:
        table = Cache[section]
    except KeyError:
        try:
            mod = __import__('unidecode.x%03x'%(section), [], [], ['data'])
        except ImportError:
            Cache[section] = None
            continue   # No match: ignore this character and carry on.

        Cache[section] = table = mod.data

    if table and len(table) > position:
        retval.append( table[position] )

return ''.join(retval)

@eangulus
Copy link
Author

Followed the Hard Reset instructions, and it started straight after, but then stopped again, and now when trying to start it shows this:

Traceback (most recent call last):
File "lib/cherrypy/_cprequest.py", line 656, in respond
response.body = self.handler()
File "lib/cherrypy/lib/encoding.py", line 188, in call
self.body = self.oldhandler(_args, *_kwargs)
File "lib/cherrypy/_cpdispatch.py", line 34, in call
return self.callable(_self.args, *_self.kwargs)
File "/home/karen/.headphones/headphones/webserve.py", line 62, in home
myDB = db.DBConnection()
File "/home/karen/.headphones/headphones/db.py", line 49, in init
self.connection.execute("PRAGMA synchronous = OFF")
OperationalError: unable to open database file

@eangulus
Copy link
Author

Oh and the instructions said I wouldn't loose all my settings and database.

Why is it all currently empty and all settings are now reset?

@basilfx
Copy link
Contributor

basilfx commented Sep 26, 2014

I think these errors are not the result of Headphones malfunctioning.

Are you sure there isn't another error causing this? Are your packages up-to-date? No disk errors? What if you try to open the database file with sqlite3 command line tool? Doest git fsck yield something problematic?

Also, the instructions also say that it should be tailored to your installation, and that you should backup your files, just in case.

@eangulus
Copy link
Author

This is a new server, that has been running for about 3-4 months now with no problems at all.

All brand new drives, none are failing or report errors. All packages upto date. Runs Couchpotato, SickRage, supposedly Headphones and was for a while, VirtualBox with a XP VM starting on Boot, and Apache.

Everything else works fine, and it never gets tinkered with either. Its a dedicated box for the above and once I had finished setting up, the only thing I do with it is update the packages around once a week.

I do know a little linux, but not sure how to open sqlite stuff.

@basilfx
Copy link
Contributor

basilfx commented Sep 26, 2014

This is what I just tested, and it works (fresh install):

basilfx:.headphones/ (master) $ python --version
Python 2.7.6
basilfx:test/ $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:        14.04
Codename:       trusty
basilfx:test/ $ git clone https://github.com/rembo10/headphones.git
Cloning into 'headphones'...
remote: Counting objects: 11605, done.
remote: Compressing objects: 100% (67/67), done.
remote: Total 11605 (delta 9), reused 0 (delta 0)
Receiving objects: 100% (11605/11605), 9.99 MiB | 2.32 MiB/s, done.
Resolving deltas: 100% (7006/7006), done.
Checking connectivity... done.
basilfx:test/ $ cd headphones
basilfx:headphones/ (master) $ python Headphones.py -v
26-Sep-2014 02:24:58 - INFO :: MainThread : Checking to see if the database has all tables....
26-Sep-2014 02:24:59 - DEBUG :: MainThread : Trying to execute: "git rev-parse HEAD" with shell in /tmp/test/headphones
26-Sep-2014 02:24:59 - DEBUG :: MainThread : Git output: 3f5044c82d4c1293abbf1e4a601623fe123474e9
26-Sep-2014 02:24:59 - DEBUG :: MainThread : Trying to execute: "git rev-parse --abbrev-ref HEAD" with shell in /tmp/test/headphones
26-Sep-2014 02:24:59 - DEBUG :: MainThread : Git output: master
26-Sep-2014 02:24:59 - INFO :: MainThread : Retrieving latest version information from GitHub
26-Sep-2014 02:24:59 - DEBUG :: MainThread : Requesting URL via GET method: https://api.github.com/repos/rembo10/headphones/commits/master
26-Sep-2014 02:25:00 - DEBUG :: MainThread : Latest version is 3f5044c82d4c1293abbf1e4a601623fe123474e9
26-Sep-2014 02:25:00 - INFO :: MainThread : Headphones is up to date
26-Sep-2014 02:25:00 - DEBUG :: MainThread : Using the following server values: MBHost: musicbrainz.org, MBPort: 80, Sleep Interval: 1
26-Sep-2014 02:25:00 - INFO :: MainThread : Starting Headphones web server on http://0.0.0.0:8181/

Have you checked permissions?

@eangulus
Copy link
Author

I would check permissions but as stated before, I have limited linux knowledge, and have no idea what I am looking at. So I can check the permissions, but I have no idea if they are right or wrong seeing I have no information on what they are suppose to be.

I did notice something strange and not sure if it might help in working this out.

The Startup script that started headphones on boot (and has been working fine until recently), now does not work at all. It will not start headphones. The only way I can start it at the moment is via the CLI using python headphones.py

@eangulus
Copy link
Author

As noted before, contact me on my email info@eangulus.com and you can get SSH access to get any debug information allot faster.

@eangulus
Copy link
Author

Also looking at what shows when I start via CLI, I see this line:

no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory

I don't know what it means but I don't think its a good thing.

@eangulus
Copy link
Author

Now things are really getting confusing.

Just deleted (after backup) the headphones folder.
Followed a fresh install procedure in the Wiki.
All installed and works.

Started following Install as Daemon.
Got to the Adjust settings in /etc/default/headphones (installpath and run as user).

But file is there but empty. What am I suppose to be editing.

Also regarding lost config and database, in the /opt/headphones directory, there is a 8Mb Database and a config file with paths in it I recognize, but headphones doesn't seem to be using those. There is also a Artwork cache with heaps of stuff in it.

@basilfx
Copy link
Contributor

basilfx commented Sep 26, 2014

The no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory is a Ubuntu/Samba bug. If you googled it, you should have encountered it.

For the /etc/default/headphones contents, see the comment section in this file: https://github.com/rembo10/headphones/blob/master/init-scripts/init.ubuntu

Regarding the /opt/headphones directory: you have to setup Headphones that it will use these folders and paths. If you run python Headphones.py -h, you'll see what is expected.

Lastly, the problem you describe is most certainly not Headphones related. Don't get me wrong, I'm glad to help you, but don't expect from me to learn you the basic Linux stuff to solve your problem. That would be too much if I would help everybody posting issues here. There are support forums on the internet that can help you a lot better with issues like these.

@eangulus
Copy link
Author

Now having same issue on a totally differnet server, completly different hardware, different version of Ubuntu etc.

headphones fails to start.

But hey, its not a headphones issue.

@basilfx
Copy link
Contributor

basilfx commented Oct 10, 2014

I never said it was not a Headphones issue, but only most unlikely. I draw that conclusion because this is the only issue I saw lately on this topic, and because I cannot reproduce this error. Again, don't get me wrong: I am glad to help.

Is there a possibility you can create a Virtual Machine (e.g. with VirtualBox) with the exact same installation steps, and share it with me? Also wondering, do you use the English (UTF8) as default system locale?

@reallistic
Copy link
Contributor

I noticed in one of the previous posts you mention python 3. Please type the following in shell as basilfx mentioned:
python --version it should report 2.7.x (the x will be some other number).
If it does in fact report 3.x then this could be your issue. Some programs are simply not compatible with python 3. I am not sure however, if HP is one of them.
Try to start headphones using the following command instead:

python2.7 Headphones.py

@basilfx
Copy link
Contributor

basilfx commented Oct 26, 2014

Closed due to no response.

@basilfx basilfx closed this as completed Oct 26, 2014
@minipulator
Copy link

Having this problem myself. Just updated Headphones to current (13f34a1) and suddenly no start, lotsa errors, see below. What's interesting is that I checked out a whole new copy and still have the same problem, same error. Been running headphones for years, never had a problem before today. I'm testing it without using the init script, but same error either way. Tried develop branch, same thing. Running python 2.7.3 on Ubuntu 12.04 LTS. No rush or anything, but if I can help troubleshoot, let me know?

Traceback (most recent call last):
File "Headphones.py", line 23, in
from headphones import webstart, logger
File "/home/headphones/headphones/init.py", line 25, in
import cherrypy
File "lib/cherrypy/init.py", line 64, in
from cherrypy._cperror import HTTPError, HTTPRedirect, InternalRedirect
File "lib/cherrypy/_cperror.py", line 123, in
from cherrypy.lib import httputil as _httputil
File "lib/cherrypy/lib/init.py", line 4, in
from cherrypy.lib.reprconf import unrepr, modules, attributes
File "lib/cherrypy/lib/reprconf.py", line 23, in
from configparser import ConfigParser
File "/usr/local/lib/python2.7/dist-packages/configparser-3.5.0b1-py2.7.egg/configparser.py", line 12, in
from backports.configparser import (
File "/usr/local/lib/python2.7/dist-packages/configparser-3.5.0b1-py2.7.egg/backports/init.py", line 9, in
pkg_resources.declare_namespace(name)
AttributeError: 'module' object has no attribute 'declare_namespace'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python2.7/dist-packages/apport/init.py", line 1, in
from apport.report import Report
File "/usr/lib/python2.7/dist-packages/apport/report.py", line 20, in
import apport.fileutils
File "/usr/lib/python2.7/dist-packages/apport/fileutils.py", line 15, in
from configparser import ConfigParser, NoOptionError, NoSectionError
File "/usr/local/lib/python2.7/dist-packages/configparser-3.5.0b1-py2.7.egg/configparser.py", line 12, in
from backports.configparser import (
File "/usr/local/lib/python2.7/dist-packages/configparser-3.5.0b1-py2.7.egg/backports/init.py", line 9, in
pkg_resources.declare_namespace(name)
AttributeError: 'module' object has no attribute 'declare_namespace'

Original exception was:
Traceback (most recent call last):
File "Headphones.py", line 23, in
from headphones import webstart, logger
File "/home/headphones/headphones/init.py", line 25, in
import cherrypy
File "lib/cherrypy/init.py", line 64, in
from cherrypy._cperror import HTTPError, HTTPRedirect, InternalRedirect
File "lib/cherrypy/_cperror.py", line 123, in
from cherrypy.lib import httputil as _httputil
File "lib/cherrypy/lib/init.py", line 4, in
from cherrypy.lib.reprconf import unrepr, modules, attributes
File "lib/cherrypy/lib/reprconf.py", line 23, in
from configparser import ConfigParser
File "/usr/local/lib/python2.7/dist-packages/configparser-3.5.0b1-py2.7.egg/configparser.py", line 12, in
from backports.configparser import (
File "/usr/local/lib/python2.7/dist-packages/configparser-3.5.0b1-py2.7.egg/backports/init.py", line 9, in
pkg_resources.declare_namespace(name)
AttributeError: 'module' object has no attribute 'declare_namespace'

@basilfx
Copy link
Contributor

basilfx commented Nov 12, 2014

See #2001

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

4 participants