Hi Zohair, On Tuesday 29 June 2010 05:24:26 Zohair M. Abu Shaban wrote: > Dear Rami, > > Thanks for your reply. I am using hardware that uses some libraries on > Linux. def set_time_at_next_pps(*args, **kwargs): > """set_time_at_next_pps(self, usrp2::time_spec_t time_spec) -> > bool""" return _usrp2.usrp2_base_set_time_at_next_pps(*args, **kwargs) > > This is actually a definition of a function in C++ transformed to python. > It receives a structure parameter and returns boolean the structure is > defined like this: in a library called libusrp2.so and the header file is > usrp2.h > > typedef struct time_spec{ > uint32_t secs; > uint32_t ticks; > time_spec(void){ > secs = ~0; > ticks = ~0; > } > time_spec(uint32_t new_secs, uint32_t new_ticks = 0){ > secs = new_secs; > ticks = new_ticks; > } > } time_spec_t; > > in my python code I wrote: > zeroise=usrp2.time_spec_t(0,0) > self.$(id).set_time_at_next_pps(zeroise) > > The error Iam receiveing is : > zeroise=usrp2.time_spec_t(0,0) > AttributeError: 'module' object has no attribute 'time_spec_t' >
Thank you for the details. Could you let me know how you're accessing the C++ code? Are you using ctypes? Are you using a Python extension module that wraps the C++ code? Some other method? > MY PROBLEM THAT I NEED HELP FOR IS: > 1- Am I using the structure correctly? > 2- Am I invoking the python definition correctly? I'd guess not, since you're getting an error ;-) > > Thanks againg for your help. > > JZK > > Zohair > > > From: rami.chowdh...@gmail.com > > To: python-list@python.org > > Subject: Re: C++/Python function call > > Date: Mon, 28 Jun 2010 13:05:20 -0700 > > CC: zohair...@hotmail.com > > > > On Monday 28 June 2010 12:46:13 Zohair M. Abu Shaban wrote: > > > Hello every one: > > > > > > > > > I have this python function defined as: > > > > > > def set_time_at_next_pps(self, *args, **kwargs): > > > """set_time_at_next_pps(self, usrp2::time_spec_t time_spec) > > > > > > -> bool""" > > > > > > > > > > > > it was generated to do the same function as the c++: > > > > > > set_time_at_next_pps(usrp2::time_spec_t(0, 0)) > > > > > > > > > I am new to python and don't know hoe to use this python syntax. > > > > > > Any hint or help please? > > > > Can you give us a little more information? What do you need to use it > > for? > > > > > Cheers > > > > > > > > > Zoh > > > _________________________________________________________________ > > > http://clk.atdmt.com/UKM/go/197222280/direct/01/ > > > Do you have a story that started on Hotmail? Tell us now > > > > ---- > > Rami Chowdhury > > "Given enough eyeballs, all bugs are shallow." -- Linus' Law > > +1-408-597-7068 / +44-7875-841-046 / +88-01819-245544 > > _________________________________________________________________ > http://clk.atdmt.com/UKM/go/197222280/direct/01/ > Do you have a story that started on Hotmail? Tell us now ---- Rami Chowdhury "It always takes longer than you expect, even when you take Hofstadter's Law into account." -- Hofstadter's Law +1-408-597-7068 / +44-7875-841-046 / +88-01819-245544 -- http://mail.python.org/mailman/listinfo/python-list