numpy results in segmentation fault

Aldwin Pollefeyt aldwinaldwindev at gmail.com
Fri Sep 20 00:08:14 EDT 2019


use:

num_arr1 = numpy.array(tgt_arr1, dtype=int)
num_arr2 = numpy.array(tgt_arr2, dtype=int)


On Mon, Sep 16, 2019 at 5:36 PM Pradeep Patra <smilesonisamal at gmail.com>
wrote:

> Yes it is crashing in the hackerrank site and the testcases fails with
> segmentation fault. I tried to install numpy with 3.7.3 and it is for some
> reason not working and after import when I run import numpy at python
> console and press enter I get >>? i,e its not working properly.
>
> Can you please help letting me know the python and numpy compatibility
> matrix or I am missing anything?
>
> I tried some of the numpy code from the other github and it also fails with
> the segmentation fault :-(. I am guessing some numpy version compatility
> issue or some environment issue.
>
> On Thu, Sep 12, 2019 at 8:00 PM Thomas Jollans <tjol at tjol.eu> wrote:
>
> > On 12/09/2019 15.53, Pradeep Patra wrote:
> > > Hi ,
> > >
> > > I was trying to solve the hackerrank and was using python 3.7.x.
> > > https://www.hackerrank.com/challenges/np-concatenate/problem
> > >
> > > While running the code sometimes I get success result and sometimes it
> > > fails with "Segmentation Fault" at Hacker rank UI. I dont have any clue
> > why
> > > the code is crashing ? Does anyone have any idea?
> >
> >
> > Are you sure it's your code that's crashing, and not something beyond
> > your control? (Such as the software that is starting Python for you)
> > Does it depend on the input? Can you reproduce the issue in a controlled
> > environment (i.e. on your own PC)?
> >
> >
> > >
> > > Regards
> > > Pradeep
> > >
> > > import numpy
> > >
> > > n,m,p = map(int,input().split())
> > > tgt_arr1 = []
> > > for i in range(n):
> > >     row = list(map(int,input().split()))
> > >     tgt_arr1.append(row)
> > > tgt_arr2 = []
> > > for j in range(m):
> > >     row = list(map(int,input().split()))
> > >     tgt_arr2.append(row)
> > >
> > > num_arr1 = numpy.array(tgt_arr1,int)
> > > num_arr2 = numpy.array(tgt_arr2,int)
> > >
> > > print(numpy.concatenate((num_arr1,num_arr2),axis=0))
> >
> >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> --
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list