Solved

socket erroe when invoking python from java app

Posted on 2004-09-09
3
229 Views
Last Modified: 2010-04-16
hi everyone,

I seem to have a winsock error when I tried to invoke my python xml server from within my java application. I know the server works fine because I checked it independently, I also manually started the server and then call the functions from my java app the problem is when I tried to start the python server from within the app I get the following error

Traceback (most recent call last):

  File "C:/Python23/new folder/file.py", line 1307, in ?

    server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8080))

  File "C:\Python23\lib\SimpleXMLRPCServer.py", line 450, in __init__

    SocketServer.TCPServer.__init__(self, addr, requestHandler)

  File "C:\Python23\lib\SocketServer.py", line 329, in __init__

    self.socket_type)

  File "C:\Python23\lib\socket.py", line 154, in __init__

    _sock = _realsocket(family, type, proto)

socket.error: (10091, 'Network subsystem is unvailable')


Any idea on why this happens?

thanks
0
Comment
Question by:jom20
3 Comments
 
LVL 11

Accepted Solution

by:
cjjclifford earned 50 total points
ID: 12024989
Hi,

Its probably related to runtime environments in this case - when you run the python application from cmdline, and it works, have a look at the environment (particularly around Python related paths/variables, and shared library/DLL paths/variables (its likely that the socket library (winsock?) is a DLL that needs some environment set (I don't use windows, so I can't figure it out completely). The environment that the java program is invoked is not passed on in calls to Runtime.exec(), you have to use the Runtime.exec() method that allows setting environment (i.e. the one with 3 arguments).

Try the following:

list the environment from cmdline.
run the python program
if the program works, unset one of the environment variables.
keep trying till one the program fails for the same reason as it is in Java - this is what needs to be set!

Cheers,
C.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Python  -  List Iteration output problem 2 64
Python tuples 2 115
Python - How does this 2D array not work? 3 75
Trying to run a Python File 11 63
This article will show the steps for installing Python on Ubuntu Operating System. I have created a virtual machine with Ubuntu Operating system 8.10 and this installing process also works with upgraded version of Ubuntu OS. For installing Py…
A set of related code is known to be a Module, it helps us to organize our code logically which is much easier for us to understand and use it. Module is an object with arbitrarily named attributes which can be used in binding and referencing. …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now