how to compare below 2 json structure in python

2012-06-21 Thread hisan
sample_json1={{
   "globalControlId": 72,
   "value": 0,
   "controlId": 2
   },
   {
   "globalControlId": 77,
   "value": 3,
   "controlId": 7
   }
}

sample_json2={
   {
   "globalControlId": 77,
   "value": 3,
   "controlId": 7
   },
{
   "globalControlId": 72,
   "value": 0,
   "controlId": 2
   }
}
-- 
http://mail.python.org/mailman/listinfo/python-list


How keep python socket alive for ever by setting Keep alive flag.

2012-06-25 Thread hisan
Hi All,

I want to open a socket connection and keep it alive for ever or until i 
explicitly close the socket connection.

below is my code though i have set keep alive flag the socket gets closed after 
some time .please help me out here

sb_sock = socket.socket(socket.AF_INET,
socket.SOCK_STREAM,socket.SOL_TCP)
sb_sock.setsockopt( socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
sb_sock.connect((msg_host, host_port))
sb_sock.send(reg_msg)
-- 
http://mail.python.org/mailman/listinfo/python-list


How to import data from MySQL db into excel sheet

2011-06-02 Thread hisan
Please let me know how can i import my sql data of multiple rows and
columns into an excel sheet.
here i need to adjust the column width based on the on the data that
sits into the column
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to import data from MySQL db into excel sheet

2011-06-02 Thread hisan
On Jun 2, 5:19 pm, Martin Brochhaus 
wrote:
> Why do you need to do this with python? Why not output the SQL data as a .cvs 
> and open that file in Excel. The user can then adjust column widths as he 
> likes.
>
> If it has to be done programatically, you might want to start your journey 
> here:http://www.python-excel.org/
>
> Best regards,
> Martin



Currently i am importing the Database into CSV file using csv module,
in csv file i need to change the column width according the size of
the data. i need to set different column width for different columns
pleas let me know how to achieve this
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to import data from MySQL db into excel sheet -- Very Urgent

2011-06-03 Thread hisan
Task i need to achieve here is:
I need to write a python script which fetches all the data from the
MySQL database and dumps into an excel sheet. since i was not able to
dump the data into excel sheet i used CSV file which looks similar to
excel sheet.
on dumping the data into CSV file i came know that column width is too
small and hence it was not possible to display data properly.
Hence i requested the way to increase the column widht to accommodate
data of any length.

below is my sample code


import os,time
import MySQLdb
import csv
db=MySQLdb.Connect("localhost","root","san123","phone")
cursor=db.cursor()

cursor.execute("select column_name from information_schema.columns
where table_name='phonebook'")
row=cursor.fetchall()
f=open(os.getcwd()+"\\analytics.csv",'w')
writer = csv.writer(f)
writer.writerow(row)
cursor.execute("select * from phonebook")
col_val=cursor.fetchall()
writer.writerows(col_val)
f.close()

My Main objective is to fetch the data and from database and dump it
into excel sheet or csv file using Python.
If there any ways to achieve this using python please let me know.

Waiting for the early response-

I need to achieve my task using python only






On Jun 2, 2:48 pm, Dennis Lee Bieber  wrote:
> On Thu, 2 Jun 2011 10:25:24 -0700 (PDT), hisan 
> declaimed the following in gmane.comp.python.general:
>
>
>
> > Currently i am importing the Database into CSV file using csv module,
> > in csv file i need to change the column width according the size of
> > the data. i need to set different column width for different columns
> > pleas let me know how to achieve this
>
>         Since CSV files are purely text, no Excel Spreadsheet visual
> attributes can be defined in them...
>
>         Take Python out of the equation.
>
>         How would you change column width using an Excel VBA script/macro?
>
>         When you can answer that, you will have the answer of how to do it
> from Python...
> --
>         Wulfraed                 Dennis Lee Bieber         AF6VN
>         [email protected]    HTTP://wlfraed.home.netcom.com/

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


Import error while running python application on Mac OS

2011-06-08 Thread hisan
HI All,

I have created an application for Mac OS using py2app module, in my
python script i have external modules such as MySQLdb and other ,
while trying to run on Mac OS i get an error saying unable to import
the module MySQLdb.
On Windows i convert python script to an exe using py2exe module and
if i install VC++ on y machine my exe runs fine.
Is there any dependency on MAC OS.

Please let me know how to resolve my issue

--
Regards,
Santosh
-- 
http://mail.python.org/mailman/listinfo/python-list


Python 2.6 OR 3.2

2011-06-09 Thread hisan
Hi All,

Please let me know which one is GOOD whether Python 2.6 OR 3.2.
Please let me know the difference between them.
Please give some refernce site or books to know the difference
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Import error while running python application on Mac OS

2011-06-09 Thread hisan
On Jun 8, 9:20 pm, hisan  wrote:
> HI All,
>
> I have created an application for Mac OS using py2app module, in my
> python script i have external modules such as MySQLdb and other ,
> while trying to run on Mac OS i get an error saying unable to import
> the module MySQLdb.
> On Windows i convert python script to an exe using py2exe module and
> if i install VC++ on y machine my exe runs fine.
> Is there any dependency on MAC OS.
>
> Please let me know how to resolve my issue
>
> --
> Regards,
> Santosh

Can Some one reply for this Please
-- 
http://mail.python.org/mailman/listinfo/python-list


How to create n number of threads

2011-06-28 Thread hisan
How to create n number thread in python. i want iterate over the for loop and 
create a thread for each iteration .
sample code
 for i in range(o,50):
 i want to create 50 thread here which call the same function. how start and 
stop each thread after completion
-- 
http://mail.python.org/mailman/listinfo/python-list


how to call a function for evry 10 secs

2011-06-29 Thread hisan
Hi All,
I need to call a function for evry 10 secs
how can i achieve this in python
-- 
http://mail.python.org/mailman/listinfo/python-list


Unable to install xmldiff package on WIndows7

2012-01-03 Thread hisan
Hi All

i have downloaded "xmldiff-0.6.10" from their official site (http://
www.logilab.org/859).
I have tried installing the same on my 32 bit Windows 7 OS using the
command "setup.py install" but below exceptions are thrown in the
console.
please help me out in installing this package on Windows

Exceptions thrown while installing


C:\Users\santosh\Downloads\xmldiff-0.6.10>setup.py build
running build
running build_py
package init file '.\test\__init__.py' not found (or not a regular
file)
package init file '.\test\__init__.py' not found (or not a regular
file)
running build_ext
building 'xmldiff.maplookup' extension
gcc -mno-cygwin -mdll -O -Wall -ID:\Python26\include -ID:\Python26\PC -
c extensions/maplookup.c -o b
uild\temp.win32-2.6\Release\extensions\maplookup.o
error: command 'gcc' failed: No such file or directory


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


Re: Unable to install xmldiff package on WIndows7

2012-01-05 Thread hisan
Can some one help me out here Its High Priority



On Jan 4, 12:47 am, hisan  wrote:
> Hi All
>
> i have downloaded "xmldiff-0.6.10" from their official site 
> (http://www.logilab.org/859).
> I have tried installing the same on my 32 bit Windows 7 OS using the
> command "setup.py install" but below exceptions are thrown in the
> console.
> please help me out in installing this package on Windows
>
> Exceptions thrown while installing
>
> C:\Users\santosh\Downloads\xmldiff-0.6.10>setup.py build
> running build
> running build_py
> package init file '.\test\__init__.py' not found (or not a regular
> file)
> package init file '.\test\__init__.py' not found (or not a regular
> file)
> running build_ext
> building 'xmldiff.maplookup' extension
> gcc -mno-cygwin -mdll -O -Wall -ID:\Python26\include -ID:\Python26\PC -
> c extensions/maplookup.c -o b
> uild\temp.win32-2.6\Release\extensions\maplookup.o
> error: command 'gcc' failed: No such file or directory

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