Thread: [Pyobjc-dev] Using C Datatypes
Brought to you by:
ronaldoussoren
From: Jan-Hendrik H. <j-h...@tu...> - 2009-10-09 15:10:14
|
Hi! Maybe this question was answered before, but I couldn't find it in the archive. How can I use C data types in Python? Concrete: I want to use - (NSInteger)write:(const uint8_t *)buffer maxLength:(NSUInteger)length of the NSOutputStream class. How can I create the buffer? Thanks Jan |
From: Ronald O. <ron...@ma...> - 2009-10-09 15:15:55
|
On Friday, October 09, 2009, at 04:53PM, "Jan-Hendrik Hanne" <j-h...@tu...> wrote: >Hi! > >Maybe this question was answered before, but I couldn't find it in the >archive. >How can I use C data types in Python? >Concrete: I want to use >- (NSInteger)write:(const uint8_t *)buffer maxLength:(NSUInteger)length >of the NSOutputStream class. >How can I create the buffer? The buffer should be a python string, or another type that implements the buffer protocol (an array.array of bytes should therefore also work). That is: aStream.write_maxLength_("hello world", 10) Ronald > >Thanks >Jan > >------------------------------------------------------------------------------ >Come build with us! The BlackBerry(R) Developer Conference in SF, CA >is the only developer event you need to attend this year. Jumpstart your >developing skills, take BlackBerry mobile applications to market and stay >ahead of the curve. Join us from November 9 - 12, 2009. Register now! >http://p.sf.net/sfu/devconference >_______________________________________________ >Pyobjc-dev mailing list >Pyo...@li... >https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > |
From: Jan-Hendrik H. <j-h...@tu...> - 2009-10-09 18:04:23
|
Hi! Ronald Oussoren wrote: > > On Friday, October 09, 2009, at 04:53PM, "Jan-Hendrik Hanne" <j-h...@tu...> wrote: >> Hi! >> >> Maybe this question was answered before, but I couldn't find it in the >> archive. >> How can I use C data types in Python? >> Concrete: I want to use >> - (NSInteger)write:(const uint8_t *)buffer maxLength:(NSUInteger)length >> of the NSOutputStream class. >> How can I create the buffer? > > The buffer should be a python string, or another type that implements the buffer protocol (an array.array of bytes should therefore also work). > > That is: > > aStream.write_maxLength_("hello world", 10) Thank you for your fast answer. Unfortunately, it doesn't work with a string. I decided to write the file in the python way. Hopefully it is fast enough. Jan > > Ronald >> Thanks >> Jan >> >> ------------------------------------------------------------------------------ >> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >> is the only developer event you need to attend this year. Jumpstart your >> developing skills, take BlackBerry mobile applications to market and stay >> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >> http://p.sf.net/sfu/devconference >> _______________________________________________ >> Pyobjc-dev mailing list >> Pyo...@li... >> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev >> >> > |
From: Ronald O. <ron...@ma...> - 2009-10-09 20:20:31
|
Jan, - how does it not work? - which version of pyobjc are you using? - and on which os-release? Ronald On 9 okt 2009, at 20:04, Jan-Hendrik Hanne <j-h...@tu...> wrote: > Hi! > > Ronald Oussoren wrote: >> On Friday, October 09, 2009, at 04:53PM, "Jan-Hendrik Hanne" <j-h...@tu... >> > wrote: >>> Hi! >>> >>> Maybe this question was answered before, but I couldn't find it in >>> the archive. >>> How can I use C data types in Python? >>> Concrete: I want to use >>> - (NSInteger)write:(const uint8_t *)buffer maxLength:(NSUInteger) >>> length >>> of the NSOutputStream class. >>> How can I create the buffer? >> The buffer should be a python string, or another type that >> implements the buffer protocol (an array.array of bytes should >> therefore also work). >> That is: >> aStream.write_maxLength_("hello world", 10) > > Thank you for your fast answer. Unfortunately, it doesn't work with > a string. I decided to write the file in the python way. Hopefully > it is fast enough. > > Jan > >> Ronald >>> Thanks >>> Jan >>> >>> --- >>> --- >>> --- >>> --- >>> ------------------------------------------------------------------ >>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >>> is the only developer event you need to attend this year. >>> Jumpstart your >>> developing skills, take BlackBerry mobile applications to market >>> and stay ahead of the curve. Join us from November 9 - 12, 2009. >>> Register now! >>> http://p.sf.net/sfu/devconference >>> _______________________________________________ >>> Pyobjc-dev mailing list >>> Pyo...@li... >>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev >>> >>> > |
From: Jan-Hendrik H. <j-h...@tu...> - 2009-10-09 23:42:54
|
Hi Ronald, Ronald Oussoren schrieb: > - how does it not work? > - and on which os-release? I am using the Iphone, this might be the problem. This is my code: self.stream=NSOutputStream.alloc().initToFileAtPath_append_(self.pathToFile,YES) self.stream.open() Works great so far. Empty file is created. stream.write_maxLength_("test",4) App crashes here > - which version of pyobjc are you using? 1946-3 Jan > Ronald > > > > On 9 okt 2009, at 20:04, Jan-Hendrik Hanne <j-h...@tu...> wrote: > >> Hi! >> >> Ronald Oussoren wrote: >>> On Friday, October 09, 2009, at 04:53PM, "Jan-Hendrik Hanne" >>> <j-h...@tu...> wrote: >>>> Hi! >>>> >>>> Maybe this question was answered before, but I couldn't find it in >>>> the archive. >>>> How can I use C data types in Python? >>>> Concrete: I want to use >>>> - (NSInteger)write:(const uint8_t *)buffer maxLength:(NSUInteger)length >>>> of the NSOutputStream class. >>>> How can I create the buffer? >>> The buffer should be a python string, or another type that implements >>> the buffer protocol (an array.array of bytes should therefore also >>> work). >>> That is: >>> aStream.write_maxLength_("hello world", 10) >> >> Thank you for your fast answer. Unfortunately, it doesn't work with a >> string. I decided to write the file in the python way. Hopefully it is >> fast enough. >> >> Jan >> >>> Ronald >>>> Thanks >>>> Jan >>>> >>>> ------------------------------------------------------------------------------ >>>> >>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >>>> is the only developer event you need to attend this year. Jumpstart >>>> your >>>> developing skills, take BlackBerry mobile applications to market and >>>> stay ahead of the curve. Join us from November 9 - 12, 2009. >>>> Register now! >>>> http://p.sf.net/sfu/devconference >>>> _______________________________________________ >>>> Pyobjc-dev mailing list >>>> Pyo...@li... >>>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev >>>> >>>> >> > -- Jan-Hendrik Hanne Mittelweg 94 38106 Braunschweig Tel: 0531/2889855 |
From: Ronald O. <ron...@ma...> - 2009-10-11 11:04:11
Attachments:
smime.p7s
|
On 10 Oct, 2009, at 1:42, Jan-Hendrik Hanne wrote: > Hi Ronald, > > Ronald Oussoren schrieb: >> - how does it not work? >> - and on which os-release? > > I am using the Iphone, this might be the problem. I don't support PyObjC on iPhone and won't do so until there is a way to run python code on the iPhone without breaking the SDK rules. > > This is my code: > > self.stream=NSOutputStream.alloc().initToFileAtPath_append_ > (self.pathToFile,YES) > self.stream.open() > > Works great so far. Empty file is created. > > stream.write_maxLength_("test",4) > App crashes here > This works fine with the current trunk on OSX 10.6: >>> from Foundation import NSOutputStream >>> s = NSOutputStream.alloc().initToFileAtPath_append_('/tmp/ log.txt', False) >>> s.open() >>> s.write_maxLength_('test', 4) 4 >>> s.close() The file then contains the bytes I wrote to it. >> - which version of pyobjc are you using? > > 1946-3 I have no idea what this version number means, this might be some internal version code for the iPhone port. Please ask the developer of the iPhone port to investigate, this seems to be a problem in that port. Ronald > > Jan > >> Ronald >> On 9 okt 2009, at 20:04, Jan-Hendrik Hanne <j-h...@tu...> >> wrote: >>> Hi! >>> >>> Ronald Oussoren wrote: >>>> On Friday, October 09, 2009, at 04:53PM, "Jan-Hendrik Hanne" <j-h...@tu... >>>> > wrote: >>>>> Hi! >>>>> >>>>> Maybe this question was answered before, but I couldn't find it >>>>> in the archive. >>>>> How can I use C data types in Python? >>>>> Concrete: I want to use >>>>> - (NSInteger)write:(const uint8_t *)buffer maxLength:(NSUInteger) >>>>> length >>>>> of the NSOutputStream class. >>>>> How can I create the buffer? >>>> The buffer should be a python string, or another type that >>>> implements the buffer protocol (an array.array of bytes should >>>> therefore also work). >>>> That is: >>>> aStream.write_maxLength_("hello world", 10) >>> >>> Thank you for your fast answer. Unfortunately, it doesn't work >>> with a string. I decided to write the file in the python way. >>> Hopefully it is fast enough. >>> >>> Jan >>> >>>> Ronald >>>>> Thanks >>>>> Jan >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Come build with us! The BlackBerry(R) Developer Conference in >>>>> SF, CA >>>>> is the only developer event you need to attend this year. >>>>> Jumpstart your >>>>> developing skills, take BlackBerry mobile applications to market >>>>> and stay ahead of the curve. Join us from November 9 - 12, 2009. >>>>> Register now! >>>>> http://p.sf.net/sfu/devconference >>>>> _______________________________________________ >>>>> Pyobjc-dev mailing list >>>>> Pyo...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev >>>>> >>>>> >>> > > -- > Jan-Hendrik Hanne > Mittelweg 94 > 38106 Braunschweig > Tel: 0531/2889855 |
From: Leonardo S. <san...@gm...> - 2009-10-11 15:54:35
|
On Oct 11, 2009, at 8:03 AM, Ronald Oussoren wrote: > > On 10 Oct, 2009, at 1:42, Jan-Hendrik Hanne wrote: > >> Hi Ronald, >> >> Ronald Oussoren schrieb: >>> - how does it not work? >>> - and on which os-release? >> >> I am using the Iphone, this might be the problem. > > I don't support PyObjC on iPhone and won't do so until there is a > way to run python code on the iPhone without breaking the SDK rules. > What sdk rules does it break? Aparently the no interpreter rule is just for the download of code to be interpreted. Theres already a ton of lua apps on the iphone. -- Leonardo Santagada santagada at gmail.com |
From: Ronald O. <ron...@ma...> - 2009-10-11 19:49:08
Attachments:
smime.p7s
|
On 11 Oct, 2009, at 17:54, Leonardo Santagada wrote: > > On Oct 11, 2009, at 8:03 AM, Ronald Oussoren wrote: > >> >> On 10 Oct, 2009, at 1:42, Jan-Hendrik Hanne wrote: >> >>> Hi Ronald, >>> >>> Ronald Oussoren schrieb: >>>> - how does it not work? >>>> - and on which os-release? >>> >>> I am using the Iphone, this might be the problem. >> >> I don't support PyObjC on iPhone and won't do so until there is a >> way to run python code on the iPhone without breaking the SDK rules. >> > > What sdk rules does it break? Aparently the no interpreter rule is > just for the download of code to be interpreted. Theres already a ton > of lua apps on the iphone. Last time I checked (around the 3.0 release) the SDK did not allow interpreted languages other than the ones supplied by Apple. Other than that I don't have the time to work on an official port of PyObjC to the iPhone, its hard enough to find enough time to seriously work on PyObjC for OSX. Ronald |