acsone / odoo-autodiscover

GNU Lesser General Public License v3.0
8 stars 5 forks source link

The odoo.py executable could not be found, therefore odoo-autodiscover.py can not start. #2

Closed max3903 closed 7 years ago

max3903 commented 7 years ago

Hello,

I setup a virtual environment to install odoo-autodiscover and Odoo 9.

When I try to use the odoo-autodiscover.py in my init script to start Odoo 9.0, I get this error message:

The odoo.py executable could not be found, therefore odoo-autodiscover.py can not start.

Here is my init script:

#!/bin/sh

### BEGIN INIT INFO
# Provides:             odoo
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Should-Start:         $network
# Should-Stop:          $network
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Enterprise Business Applications
# Description:          ODOO Business Applications
### END INIT INFO

PATH=/usr/local/bin:/bin:/sbin:/usr/bin
DAEMON="/opt/odoo/env/bin/odoo-autodiscover.py"
NAME=odoo
DESC=odoo

# Specify the user name (Default: odoo).
USER=odoo

# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/odoo/odoo.conf"

# pidfile
PIDFILE=/var/run/$NAME.pid

# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"
[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0

checkpid() {
    [ -f $PIDFILE ] || return 1
    pid=`cat $PIDFILE`
    [ -d /proc/$pid ] && return 0
    return 1
}

case "${1}" in
start)
    echo -n "Starting ${DESC}: "
    start-stop-daemon --start --quiet --pidfile ${PIDFILE}  --chuid ${USER} --background --make-pidfile     --exec ${DAEMON} -- ${DAEMON_OPTS}
    echo "${NAME}."
    ;;
stop)
    echo -n "Stopping ${DESC}: "
    start-stop-daemon --stop --quiet --pidfile ${PIDFILE}   --oknodo
    echo "${NAME}."
    ;;
restart|force-reload)
    echo -n "Restarting ${DESC}: "
    start-stop-daemon --stop --quiet --pidfile ${PIDFILE}   --oknodo
    sleep 1
    start-stop-daemon --start --quiet --pidfile ${PIDFILE}  --chuid ${USER} --background --make-pidfile     --exec ${DAEMON} -- ${DAEMON_OPTS}
    echo "${NAME}."
    ;;
*)
    N=/etc/init.d/odoo/${NAME}
    echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac
exit 0

Work around

I changed the odoo-autodiscover.py to have:

    odoo_py = find_executable('odoo.py', path='/opt/odoo/env/bin')
sbidoul commented 7 years ago

Can you try DAEMON="/opt/odoo/env/bin/openerp-server-autodiscover" which is the alter-ego of the standard openerp-server? This should work.

This issue comes up from time to time indeed.odoo-autodiscover.py should look for odoo.py in its own directory first before looking in the PATH.

The reason I've never fixed this properly is that we normally use odoo-autodiscover.py during development only, in a properly activated virtualenv (where odoo.py is therefore in the PATH`). And the alternative above works fine.

max3903 commented 7 years ago

@sbidoul Thanks! It worked.