concat string and dict in print statement

2014-12-05 Thread gaurangnshah
Hi Guys, 

I am trying to combine string and dict in the print statement, however getting 
an error. Would someone let me know what will be correct way to do that.

stats={'lname': 'shah', 'fname': 'gaurang'}
a=test

print "%s %(fname)s %(lname)s" %(a,stats)

Following is the error I am getting 
Traceback (most recent call last):
  File "", line 1, in 
TypeError: format requires a mapping
-- 
https://mail.python.org/mailman/listinfo/python-list


Verify JSON Data

2014-05-26 Thread gaurangnshah
Hi Guys, 

Would someone let me know how to verify JSON data in python. There are so many 
modules available to verify XML file, however i didn't find any good module to 
verify JSON Data. 

After searching on the internet i came across JSON module, however it only 
coverts the JSON data to python. it's good, however the problem comes when JSON 
response is very large.  

Is there any module through which i can verify JSON file like DOM or Object 
oriented way. ( i.e. data.key)
-- 
https://mail.python.org/mailman/listinfo/python-list


How to execute command on remote windows machine

2013-09-02 Thread gaurangnshah
Hi Guys, 

I have a requirement where i need to kill one process on remote windows 
machine. 
Following command just works fine if i have to kill process on local machine 

os.system('taskkill /f /im processName.exe')

However I am not able to figure out how to execute this command on remote 
windows machine. 

Note: my local machine is also windows (machine from where i have to execute 
command)

so is there any way i can execute command from windows machine on remote 
windows machine ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to execute command on remote windows machine

2013-09-02 Thread gaurangnshah
Hi alex 

I tried the command you suggested however it is giving me following error. 

ERROR: The RPC server is unavailable.

On Tuesday, 3 September 2013 11:03:17 UTC+5:30, alex23  wrote:
> On 3/09/2013 2:45 PM, gaurangns...@gmail.com wrote:
> 
> > I have a requirement where i need to kill one process on remote windows 
> > machine.
> 
> > Following command just works fine if i have to kill process on local machine
> 
> >
> 
> > os.system('taskkill /f /im processName.exe')
> 
> >
> 
> > However I am not able to figure out how to execute this command on remote 
> > windows machine.
> 
> 
> 
> The simplest way is from your local machine. taskkill accepts a /s 
> 
> parameter which can specify a remote machine by IP or name.
> 
> 
> 
> http://technet.microsoft.com/en-us/library/bb491009.aspx



On Tuesday, 3 September 2013 11:03:17 UTC+5:30, alex23  wrote:
> On 3/09/2013 2:45 PM, gaurangns...@gmail.com wrote:
> 
> > I have a requirement where i need to kill one process on remote windows 
> > machine.
> 
> > Following command just works fine if i have to kill process on local machine
> 
> >
> 
> > os.system('taskkill /f /im processName.exe')
> 
> >
> 
> > However I am not able to figure out how to execute this command on remote 
> > windows machine.
> 
> 
> 
> The simplest way is from your local machine. taskkill accepts a /s 
> 
> parameter which can specify a remote machine by IP or name.
> 
> 
> 
> http://technet.microsoft.com/en-us/library/bb491009.aspx
-- 
http://mail.python.org/mailman/listinfo/python-list