Help turning code into a module

2005-12-20 Thread dylpkls91
Hi all,

I am working on a little program for home automation under the X10
protocol. I have given up using a Palm device for input, so I have
resorted to using voice recognition, which I knew nothing about.
However, I found a nice little script on the internet that does exactly
what I need, and it recognizes phrases with pretty much 100% accuracy.
The script can be found here:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/93025

What I want to do is make this code into a module, so I can use it in
the future. For example:

import voicerecognition as vr
vr.StartRecognition(["one", "two", "three"])
result = vr.GetRecognized()
if result == "one":
 print "You said: one"
else:
 print "You did not say 'one'."

Any help would be appreciated. I have tried this, but IDLE keeps
freezing whenever I try to use the module with a test script.
Specifically, if anyone could actually turn this into a module for me,
I would be extremely grateful. Thank you!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Execute Commands on Remote Computers over Network

2006-07-12 Thread dylpkls91
I'm sorry, I should have clarified. I want to execute commands on
networked computers running Windows XP. Thank you for you
concern anyway. Does this mean that the Paramiko module only works on
Unix systems?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Execute Commands on Remote Computers over Network

2006-07-13 Thread dylpkls91

Ben Sizer wrote:
> Paramiko appears to use SSH, which (as far as I know)
> connects to a computer running an sshd program or equivalent and
> executes commands via that program. If there's no sshd running on the
> target, you can't do anything.

Thanks for the clarification. Can I get 'sshd' or an equivalent for
Windows?

-- 
http://mail.python.org/mailman/listinfo/python-list


Problem Solved

2006-07-13 Thread dylpkls91
Thank you all for your responses.

I have managed to figure out a solution using XML RPC which fits my
needs perfectly.

-- 
http://mail.python.org/mailman/listinfo/python-list


XMLRPC Solution Code

2006-07-17 Thread dylpkls91
[EMAIL PROTECTED] wrote:
> Mind posting it for us lesser beings? ;)

Not at all. I have yet to test it on networked computers, but it works
fine when I run both scripts on my machine.

The hard part now is getting the server code to run as a Windows
service- argh!!!
I can get it installed and started using modified code from:
http://www.schooltool.org/products/schooltool-calendar/documentation/how-to/running-as-a-windows-service/schooltool-service.py/view

but for some reason when the server is a service the client refuses to
connect properly!
Grrr... anybody know why?

Here is the code for the server, the machine that will execute the
commands:

import SimpleXMLRPCServer, os
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8000))
server.register_function(lambda command: os.popen4(command)[1].read(),
"execute")
server.serve_forever()

And here's the code for the client, the computer that will tell the
server what command to execute:

import xmlrpclib
server = xmlrpclib.Server("http://"; + raw_input("Enter the IP address
of the server: ") + ":8000")
output = server.execute(raw_input("Enter a command for the server to
execute: "))
print output

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: XMLRPC Solution Code

2006-07-18 Thread dylpkls91
Frank Millman wrote:
> I use something called 'srvany' -
>http://support.microsoft.com/kb/q137890/

I am familiar with srvany. Seems like it is a whole bunch easier than
the PyWin32 stuff.

I'll write a wrapper script that can be used like this:
createservice.py -myservicename -myservicepath
or like this:
import createservice
createservice.install_if_needed("myservicename", "myservicepath")


I'll have my XMLRPC programcall createservice.py's install_if_needed
method.
There you have it: a foolproof, automatic, no-hassle service. Thanks
Frank!

-- 
http://mail.python.org/mailman/listinfo/python-list


Execute Commands on Remote Computers over Network

2006-06-26 Thread dylpkls91
I have been researching this topic and come up with some code to make
it work. It uses SSL and requires the 3rd party package Paramiko (which
requires PyCrypto). However, at this moment I have no network to test
the code on! Trying to connect to localhost (127.0.0.1) fails. Before I
buy network components, I want to be sure that this code will work.
Will someone with two networked computers try it out for me? Thanks!
Code:

def remotely_execute_command(ipaddr, port, user, passwd=None, cmd):
 import paramiko
 transport = paramiko.Transport(ipaddr + ":" + port)
 transport.connect(username=user, password=passwd)
 channel = transport.open_session()
 channel.exec_command(cmd)
 print "Command " + cmd + " executed by user " + user + " with
password " + passwd + " at " + host + ":" + port

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Execute Commands on Remote Computers over Network

2006-06-27 Thread dylpkls91

Lawrence D'Oliveiro wrote:
> In article <[EMAIL PROTECTED]>,
>  "dylpkls91" <[EMAIL PROTECTED]> wrote:
>
> >I have been researching this topic and come up with some code to make
> >it work. It uses SSL and requires the 3rd party package Paramiko (which
> >requires PyCrypto).
>
> Why not just spawn an invocation of SSH?

@Dennis: yes, I know, but I wasn't thinking, and it doesn't solve the
problem.

@Lawrence: I'm sorry, but I'm a newbie. Can you explain what this
means, and how I could do it in Python? Thank you very much.

-- 
http://mail.python.org/mailman/listinfo/python-list


How to initiate HotSync of Palm device?

2006-04-10 Thread dylpkls91
I am writing a program that uses the Palm handheld as a sort of input
device. However, the code that communicates with it thru the serial
port locks the port up, so if the user initiates a HotSync on the
device, the operation fails. I would like to have a setup where the
user presses a button on my Palm application to initiate a HotSync and
then continue with the Python program.

It would go like this: user presses special button on Palm, computer
closes Python/Palm connection, HotSync is executed by Python program,
computer reopens Python/Palm connection.

I know how to get the program to wait for a process to finish, but I'm
having trouble initiating a HotSync through Python. While poking around
the Palm Desktop and HotSync system files, I found a DLL called "HSAPI"
with the title "HotSync API", but I'm not sure if this is what I need.
There is no HotSync COM type library in my PythonWin COM browser.

Any and all help will be greatly appreciated. Thank you very much!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to initiate HotSync of Palm device?

2006-04-11 Thread dylpkls91
I posted a similar question on comp.sys.palmtops.pilot and am waiting
for a response. Thank you for your reply; the acknowledgement is
appreciated. I believe that a possible solution would be to use a
command line option of HotSync Manager, but I am not sure what the
correct option would be. Thanks again!

-- 
http://mail.python.org/mailman/listinfo/python-list