Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8408709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:42:29+00:00 2026-06-09T23:42:29+00:00

I am really puzzled on this issue. I am using python’s SimpleXMLRPC to provide

  • 0

I am really puzzled on this issue. I am using python’s SimpleXMLRPC to provide services to a web application.

The problem is that when I start my xmlrpc server from the command line everything runs smoothly but when it is started through crontab it doesn’t.

I have tried to hold the start-up via sleep and checking /sys/class/net/eth0/device/net/eth0/operstate but got no luck.

Please find attached the source for the script:

#!/usr/local/bin/python2.5
# -*- coding: utf-8 -*-
# License: GNU
# startxmlrpc.py: startup script for xmlrpc server to deal with processing

## {{{ http://code.activestate.com/recipes/439094/ (r1)
import socket
import fcntl
import struct

def get_ip_address(ifname):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    return socket.inet_ntoa(fcntl.ioctl(
        s.fileno(),
        0x8915,  # SIOCGIFADDR
        struct.pack('256s', ifname[:15])
        )[20:24])
## end of http://code.activestate.com/recipes/439094/ }}}

import xmlrpclib
import urllib2
import os
from SimpleXMLRPCServer import SimpleXMLRPCServer
from time import sleep

def send(img1,img2,lib,filters):

    global HOST_IP

    path = '/var/www/%s/' % MD5Cypher(HOST_IP)
    makedirs(path)
    print "Path: %s" % path

    if lib=='devel':
        os.system("""python ~/devel_funcs.py %s %s "%s" &""" % (img1_path,img2_path, filters))

    if lib=='milena':
            import milena_funcs
            milena_funcs.mln_process(img1_path, filters)

    return HOST_IP + '/' + path.split('/var/www/')[1] + 'out.pgm'


while open('/sys/class/net/eth0/operstate').read().strip() != 'up':
    sleep(5)

HOST_IP = get_ip_address('eth0')
server = SimpleXMLRPCServer((HOST_IP, 7070))
server.register_function(send)
server.serve_forever()

This is the error I get if I try to launch my process just after a clean boot:

<class 'xmlrpclib.Fault'>: <Fault 1: "<class 'xmlrpclib.ProtocolError'>:<ProtocolError for 192.168.0.5:7070/RPC2: -1 >"> 
      args = () 
      faultCode = 1 
      faultString = "<class 'xmlrpclib.ProtocolError'>:<ProtocolError for 192.168.0.5:7070/RPC2: -1 >" 
      message = ''

If I kill it and run it again, it works.

This is the crontab:

usrmln@Slave1:~$ crontab -l
# m h  dom mon dow   command
* * * * * python ~/master_register.py > /dev/null 2>&1
* * * * * python ~/startxmlrpc.py > /dev/null 2>&1
0   5 * * * find /var/www/ -type d -mtime +3 -exec rm -rf {} \; > /dev/null 2>&1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:42:30+00:00Added an answer on June 9, 2026 at 11:42 pm

    You don’t show what the error is, but, it is possibly that PYTHONPATH is not being set when run from cron. You could set it before running the script.

    Or, of course, you are running it as a different user and file permissions are not correctly set. Also ~/devel_funcs.py will not refer to your home directory if cron runs your script as a different user.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Really puzzled by the flaky behavior of LocalConnection. Using a debug utility(LuminicBox) that uses
I am really puzzled by this. I believe I am managing memory the correct
okay...im really puzzled with this. I want to create a regular asp.net webforms website
This really puzzled for hours, I searched all over the internet, but got no
I have a really strange problem and I'm completely puzzled. I have a piece
I have a really puzzling problem: I am writing a PHP CLI application running
I'm really puzzled by this one!! I'm sure it's simple but really can't figure
This problem is really puzzling to me: I have the following script working on
Alright, so this is something really basic, and I know that when someone tells
This is a puzzle to me and I am really annoyed that I cannot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.