Conversion method for PyUnicodeObject type to PyBytesObject type

2010-05-18 Thread mathan kumar
A variable whose data type is PyUnicodeObject needs to be passed to a
function as an argument whose data type should be PyBytesObject type

example :
function (PyByteObject* a){
.operations
}
PyUnicodeObject *p = somevalue;
function((PyBytesObject *)p);

ouptut: Got a Bus Error.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Issue with PyUnicodeObject type variables

2010-05-17 Thread mathan kumar
-- Forwarded message --
From: Stefan Behnel stefan...@behnel.de
To: python-list@python.org
Date: Mon, 17 May 2010 11:33:40 +0200
Subject: Re: Issue with PyUnicodeObject type variables
gmail, 17.05.2010 11:24:

 A variable whose data type is PyUnicodeObject checked whether it is a
 UnicodeObject type.
 Got output as false

 example :

 PyUnicodeObject *p;
 if (PyUnicode_Check(path)) {
 printf(\nTrue.\n);

 }
 else {
 printf(\nfalse.\n);
 }

 output: false


Doesn't surprise me at all. Could you make sure this is the code you are
using? Especially the names 'p' and 'path'? And that you are initialising
neither of the two in your code?

Stefan


Tat was a typo mistake instead of *p pls consider *path as follows.

PyUnicodeObject *path;
if (PyUnicode_Check(path)) {
printf(\nTrue.\n);

}
else {
printf(\nfalse.\n);
}
-- 
http://mail.python.org/mailman/listinfo/python-list


Issues while building pyfsevents in python 3.1

2010-04-29 Thread mathan kumar
I m trying port pyfsevents coded in python2.6 to python3.1.
But i m getting following errors while building that though i havent changed
anything in these lines.

Any idea why?


pyfsevents.c:22: error: expected specifier-qualifier-list before
‘CFFileDescriptorRef’
pyfsevents.c:30: error: expected specifier-qualifier-list before
‘FSEventStreamRef’
pyfsevents.c:60: error: expected ‘)’ before ‘streamRef’
pyfsevents.c:101: error: expected ‘)’ before ‘fdref’
pyfsevents.c:134: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
before ‘my_FSEventStreamCreate’
pyfsevents.c: In function ‘pyfsevents_registerpath’:
pyfsevents.c:183: error: ‘PyStringObject’ undeclared (first use in this
function)
pyfsevents.c:183: error: (Each undeclared identifier is reported only once
pyfsevents.c:183: error: for each function it appears in.)
pyfsevents.c:183: error: ‘path’ undeclared (first use in this function)
pyfsevents.c:190: warning: division by zero
pyfsevents.c:194: error: ‘FSEventInfo’ has no member named ‘callback’
pyfsevents.c:196: error: ‘FSEventStreamRef’ undeclared (first use in this
function)
pyfsevents.c:196: error: expected ‘;’ before ‘stream’
pyfsevents.c:197: error: ‘stream’ undeclared (first use in this function)
pyfsevents.c:211: error: ‘FSEventInfo’ has no member named ‘stream’
pyfsevents.c: In function ‘pyfsevents_registerfd’:
pyfsevents.c:244: error: ‘kCFFileDescriptorReadCallBack’ undeclared (first
use in this function)
pyfsevents.c:244: error: ‘kCFFileDescriptorWriteCallBack’ undeclared (first
use in this function)
pyfsevents.c:254: warning: initialization makes pointer from integer without
a cast
pyfsevents.c:266: error: ‘FDInfo’ has no member named ‘callback’
pyfsevents.c:268: error: ‘CFFileDescriptorContext’ undeclared (first use in
this function)
pyfsevents.c:268: error: expected ‘;’ before ‘context’
pyfsevents.c:269: error: ‘CFFileDescriptorRef’ undeclared (first use in this
function)
pyfsevents.c:269: error: expected ‘;’ before ‘fdref’
pyfsevents.c:272: error: ‘fdref’ undeclared (first use in this function)
pyfsevents.c:275: error: ‘CFFileDescriptorCallBack’ undeclared (first use in
this function)
pyfsevents.c:275: error: expected ‘)’ before ‘fd_callback’
pyfsevents.c:285: warning: assignment makes pointer from integer without a
cast
pyfsevents.c:292: error: ‘FDInfo’ has no member named ‘desc’
pyfsevents.c:307: error: ‘FDInfo’ has no member named ‘callback’
pyfsevents.c:308: error: ‘FDInfo’ has no member named ‘desc’
pyfsevents.c: In function ‘removesource’:
pyfsevents.c:373: error: ‘FSEventStreamRef’ undeclared (first use in this
function)
pyfsevents.c:373: error: expected ‘;’ before ‘stream’
pyfsevents.c:374: error: ‘stream’ undeclared (first use in this function)
pyfsevents.c: In function ‘pyfsevents_unregisterfd’:
pyfsevents.c:417: warning: initialization makes pointer from integer without
a cast
lipo: can't figure out the architecture type of:
/var/folders/fF/fFgga6+-E48RL+iXKLFmAE+++TI/-Tmp-//ccCNjSPw.out
error: command 'gcc' failed with exit status 1

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