Using Python from Cocoa App via PyObjc - numbers dont match...

2006-11-08 Thread sapsi
Hi, I managed to create a python class and instantiate that from my Objective C Cocoa App (its not a python app). Essentially, i made two classes in IB and then another class(ogle) with outlets for these two. Now here is the implementation for ogle.m -(void)awakeFromNib { NSNumber *n=[NSNumber

Re: Using Python from Cocoa App via PyObjc - numbers dont match...

2006-11-08 Thread sapsi
stinks of ignorance please forget it. Thank you Saptarshi Michael Ash wrote: > In comp.lang.objective-c sapsi <[EMAIL PROTECTED]> wrote: > > The first output in the console is 40.4 and the second > > -40.4152587891. > > > > If i change the NSLog(s) to &q

Dispatching a method using PyobjC Selectors/Methods

2007-06-26 Thread sapsi
Hi, I am writing a SIMBL plugin for Mail.app, so far it loads and the correct method has been swizzled. However, i would like to call the original method and that is where the problem lies. If you could see the code(below), in console.app, i get the following error because of old(x) " 2007-06-26 0

Using struct timeval in python

2007-09-08 Thread sapsi
Hi, I am using a library (pcapy) that returns a timeval object T= (seconds,microseconds) where microseconds is always < 1e6. Is there a Python class that can handle timeval structs? Specifically, I wish to subtract two T (defined above) objects, taking into account the large values of T[0] and T[1]

Re: Using struct timeval in python

2007-09-08 Thread sapsi
The timedelta module did the job just fine. Thank you -- http://mail.python.org/mailman/listinfo/python-list

Sets in Python

2007-09-18 Thread sapsi
Hello, I recently tried using the set function in Python and was surprised to find that a=[ 1, 2,3, [1,2] ] doesn't work with 'set', throwing TyperError (unhashable exception). I found out that this is because lists can't be hashed. So,this implies 'a' cannot be a set in python which i think is

Python,SWIG and libjvm

2007-09-20 Thread sapsi
Hello, I'm not sure if this the correct list but here goes (and sorry for the noise). I've been attempting to wrap python around libhdfs. So far so good (i've attached the SWIG template at the end). The compilation works without errors and the shared objects do have references to all the functions.

Re: Python,SWIG and libjvm

2007-09-20 Thread sapsi
On Sep 20, 7:00 pm, sapsi <[EMAIL PROTECTED]> wrote: > Hello, > I'm not sure if this the correct list but here goes (and sorry for the > noise). I've been attempting to wrap python around libhdfs. > So far so good ( I should point out that libhdfs is a c library to H

Re: Python,SWIG and libjvm

2007-09-20 Thread sapsi
On Sep 20, 8:22 pm, sapsi <[EMAIL PROTECTED]> wrote: > On Sep 20, 7:00 pm, sapsi <[EMAIL PROTECTED]> wrote: > > > Hello, > > I'm not sure if this the correct list but here goes (and sorry for the > > noise). I've been attempting to wrap python aro

Re: Sets in Python

2007-09-22 Thread sapsi
Thank you everyone for the assistance and for the very informative discussion Regards SM -- http://mail.python.org/mailman/listinfo/python-list

LoopingCall vs internet.TimerService (Twisted)

2007-10-03 Thread sapsi
Hi, I guess this is not the most appropriate forum but i tried the twisted forum to not avail so here goes. I have written a server which accepts connections from clients, takes requests and adds them to a Queue (a python object of Queue.Queue). Now i have two approaches a) At startup, my server

Passing all extra commandline arguments to python program, Optparse raises exception

2009-04-16 Thread sapsi
Hello, Im using optparse and python 2.6 to parse some options, my commandline looks like prog [options] start|stop extra-args-i-will-pas-on The options are --b --c --d The extra options are varied are are passed onto another program e.g -- quiet --no-command , my program doesnt care what these a

Reading Java byte[] data stream over standard input

2008-05-18 Thread sapsi
after \n and before the 6. My question is : how do i read binary data(Java's byte stream) from stdin? Or is this actually what i'm getting? Thanks Sapsi -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading Java byte[] data stream over standard input

2008-05-18 Thread sapsi
; Or is this actually what i'm getting? > > Thanks > Sapsi -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading Java byte[] data stream over standard input

2008-05-19 Thread sapsi
Yes, that could be the case. Browsing through hadoop's source, i see stdin in the above code is reading from piped Java DataOutputStream. I read of a libray on the net Javadata.py that reads this but it has disappeared. What is involved in reading from a Dataoutputstream? Thank you Sapsi --

Numpy, adding a row to a matrix

2008-06-09 Thread sapsi
Hello, I have a numpy array (2 rows 3 colums) import numpy a=numpy.array( [ [1,2,3] , [3,3,1] ]) I wish to add a row, this is how i do it s=a.shape numpy.resize(a,s[0]+1,s[1]) a[s[0]]=new row vector. Q: Is this a costly operation? What happens if i have to it several (and unknown) number of ti

Re: Numpy, adding a row to a matrix

2008-06-09 Thread sapsi
Hello, Thank you. Yes, I will post to the numpy mailing list in future. Regards Saptarshi On Jun 9, 4:04 pm, Robert Kern <[EMAIL PROTECTED]> wrote: > sapsi wrote: > > Hello, > > I have a numpy array (2 rows 3 colums) > > > import numpy > > a=numpy.array(  [

A Question about ctypes and a function f(void **)

2008-08-11 Thread sapsi
Hello, I have a C function f(void**,int *), in which it writes some information (it is a RGB32 image). Here is what i do rowlength=c_int() data=c_void_p() d=pointer(data) f(d,byref(rowlength) The call works (no segmentation fault), now how do i access the data in d? Because i need to pass it to a

sqlite empty inserts

2008-08-15 Thread sapsi
Hello, I created a table like: create table __saved_query__ (vdb_name text , query_table_name text PRIMARY KEY, query text) and then I insert as follows self.cursor.execute( "insert into __saved_query__(vdb_name, query_table_name, query) values (?,?,?)", (vdbname, foldername,where_query))

Re: sqlite empty inserts

2008-08-16 Thread sapsi
Hi, Thank you for the tip, you're absolutely right.I;m getting an exception that the name must not be null. However, this is some debug output --- logging.debug(" %s %s %s" % (vdbname, foldername,where_query)) OUTPUT: TestVDB test_b title regexp 'tit' --- print vdbname.__class__, foldername.__cl

Re: sqlite empty inserts

2008-08-16 Thread sapsi
I forgot to mention that i was creating a view just before this i.e sql="create view %s as %s" % (foldername, query) # self.cursor.execute(sql) self.cursor.execute(sql) Now if i remove this, the insert code works fine. Regards Saptarshi -- http://mail.python.org/mailman/listinfo/pytho

Re: sqlite empty inserts

2008-08-16 Thread sapsi
On Aug 16, 11:20 am, Peter Otten <[EMAIL PROTECTED]> wrote: > sapsi wrote: > > [please don't top-post] > > > > > Thank you for the tip, you're absolutely right.I;m getting an > > exception  that the name must not be null. However, this is some deb

QT, ctypes dll and SEG Faults

2008-08-16 Thread sapsi
Hello, Below is a small class using ctypes and libspectre to read a postscript file. My program is a PyQT 4.4 application and when the user clicks on a entry in a QTableWidget, i run PostScriptImage( filename_as_contained_in_clicked_tableWidgetItem ) However on i get a segfault while trying docum

Re: QT, ctypes dll and SEG Faults

2008-08-16 Thread sapsi
On Aug 16, 11:37 pm, sapsi <[EMAIL PROTECTED]> wrote: > Hello, > Below is a small class using ctypes and libspectre to read a > postscript file. > My program is a PyQT 4.4 application  and when the user clicks on a > entry in a QTableWidget, i ru

Write binary data to standard error?

2009-08-12 Thread sapsi
Hello, This is probably a basic question, but how does one write binary data to standard error e.g int as network order (4 bytes)? Much thanks Saptarshi -- http://mail.python.org/mailman/listinfo/python-list