LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   python problem in linux (https://www.linuxquestions.org/questions/linux-newbie-8/python-problem-in-linux-805249/)

_Linux_Learner 04-30-2010 08:21 PM

python problem in linux
 
Hi all,

I am trying to run a code that is giving the following error ....
Code:

OverflowError: long int too large to convert
I have found its solution at http://groups.google.com/group/turbo...c946efa77bc9e3

But the procedure described there does not work.. There are problems in installing ruledispatch module...

I am using ubuntu-9.04...

Please help... Thanks in advance...

Regards
_Linux_Learner

grail 04-30-2010 11:36 PM

Might help if you showed the relevant lines from your code

_Linux_Learner 05-01-2010 07:34 AM

Quote:

Originally Posted by grail (Post 3953570)
Might help if you showed the relevant lines from your code

Following is the code...
Code:

d = self.data[off+i*8:off+(i+1)*8]
            if len(d):
                q = "Q"
                l = struct.unpack(q,d)
                arr_here = array.array("L", l)

The following error creeps in...
Code:

Traceback (most recent call last):
  File "./gen_PA.py", line 107, in <module>
    main()
  File "./gen_PA.py", line 101, in main
    arr = map_for_pid.range_to_pfn(mr[k][0],mr[k][1])
  File "./gen_PA.py", line 61, in range_to_pfn
    arr_here = array.array("L", l)
OverflowError: long int too large to convert

Please help
Thanks in advance

Regards
_Linux_Learner

grail 05-01-2010 08:59 AM

So if you print the value of "l" prior to the conversion, what value is stored in it?

_Linux_Learner 05-01-2010 11:45 AM

Quote:

Originally Posted by grail (Post 3953800)
So if you print the value of "l" prior to the conversion, what value is stored in it?

The value of l that I get is....
Code:

(9655717601082849515L,)
Regards
_Linux_Learner

grail 05-01-2010 11:27 PM

hmmm ... seems I can input the following at the python prompt:

Code:

>>>import array
>>>l=(9655717601082849515L,)
>>>arr_here = array.array("L", l)
>>>print arr_here[0]
9655717601082849515

Do you get the error everytime?

_Linux_Learner 05-02-2010 12:14 AM

Quote:

Originally Posted by grail (Post 3954321)
hmmm ... seems I can input the following at the python prompt:

Code:

>>>import array
>>>l=(9655717601082849515L,)
>>>arr_here = array.array("L", l)
>>>print arr_here[0]
9655717601082849515

Do you get the error everytime?

yes I get it everytime...

Regards
_Linux_Learner


All times are GMT -5. The time now is 09:51 AM.