# Python report typeError of argument for my block

**URL:** <https://www.ruby-forum.com/t/python-report-typeerror-of-argument-for-my-block/224547>\
**Category:** GNU Radio\
**Created:** [November 16, 2012, 3:44am UTC](https://www.ruby-forum.com/t/python-report-typeerror-of-argument-for-my-block/224547 "2012-11-16T03:44:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [November 16, 2012, 3:44am UTC](https://www.ruby-forum.com/t/python-report-typeerror-of-argument-for-my-block/224547/1 "2012-11-16T03:44:55Z")

</div>

Hello,

I wrote a signal block whose constructor has an argument of type  
“uint64\_t”. But when in python it is constructed, the error is reported  
as TypeErrorL in method ‘myblock’, argument 1 of type ‘uint64\_t’.

Then I changed the uint64\_t to unsigned long long in my C++ code, but  
the  
python still report TypeError for ‘unsigned long long’.

I am thinking that SWIG can not recognize the uint64\_t and unsigned long  
long, so I need to do something like type mapping , but not know how to  
do  
it.  
Is there any example that I can follow?

Thanks

–

Alex,  
_Dreams can come true just believe._

---

<div class="post-metadata">

**Author:** ![akeem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/54ee81/32.png) [@akeem](https://www.ruby-forum.com/u/akeem)\
**Post date:** [November 16, 2012, 4:21am UTC](https://www.ruby-forum.com/t/python-report-typeerror-of-argument-for-my-block/224547/2 "2012-11-16T04:21:09Z")

</div>

On 11/15/2012 06:44 PM, Alex Z. wrote:

> long, so I need to do something like type mapping , but not know how to do  
> it.  
> Is there any example that I can follow?

It should be possible. Try adding %include \<stdint.i\> at the top of your  
swig file.

-josh

---

<div class="post-metadata">

**Author:** ![akeem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/54ee81/32.png) [@akeem](https://www.ruby-forum.com/u/akeem)\
**Post date:** [November 16, 2012, 4:40am UTC](https://www.ruby-forum.com/t/python-report-typeerror-of-argument-for-my-block/224547/3 "2012-11-16T04:40:26Z")

</div>

Thanks Josh,

Just found that my C++ interface is using type of uint64\_t while I  
passed  
the data of time\_t in python. And the python/SWIG cannot convert the  
time\_t  
to uint64\_t automatically, unlike in C++…

Changed the C++ interface to time\_t and make the type conversion within  
the  
C++ code. The constructor works in python now.

But we do need to pay attention when c++ types is not recognized in  
python,  
assuming your suggestion is a solution. I will try this later for  
possible  
case.

On Thu, Nov 15, 2012 at 9:20 PM, Josh B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > python still report TypeError for ‘unsigned long long’.
> 
> > 
> 
> * * *
> 
> Discuss-gnuradio mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

–

Alex,  
_Dreams can come true just believe._
