Re: Python 3.9 pidfd_open

2022-07-08 Thread Barry Scott



> On 5 Jul 2022, at 19:47, Weatherby,Gerard  wrote:
> 
> python introduced os.pidfd_open(), which works as documented.
> 
> My development environment, PyCharm, complains about it being undefined.
> 
> Should it be in 
> https://raw.githubusercontent.com/python/cpython/3.9/Lib/os.py ?

When faced with this type of problem I introspect from the Python REPL prompt.

Run python 3.9 and see if os.pidfd_open is defined?

Do not do this inside PyCharm to rule out a problem with PyCharm.

Also you will need to be running a linux kernel + glibc version that is new 
enough to proved this to python.

This is what I see with Fedora 36:

$ python3.9
Python 3.9.13 (main, Jun  9 2022, 00:00:00)
[GCC 12.1.1 20220507 (Red Hat 12.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
:>>> import os
:>>> os.pidfd_open

:>>>

Barry


> 
> --
> Gerard Weatherby | Application Architect
> NMRbox | NAN | Department of Molecular Biology and Biophysics | UConn Health
> 263 Farmington Avenue, Farmington, CT 06030-6406
> uchc.edu
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


TENGO PROBLEMAS AL INSTALAR PYTHON

2022-07-08 Thread ANGIE ODETTE LIMA BANGUERA
buenos dias necesito ayuda, tengo problemas al momento de instalar python
10.0 en la aplicación de visual studio code
-- 
https://mail.python.org/mailman/listinfo/python-list


NILEARN - WHY THIS CODE THROWS AN ERROR?????

2022-07-08 Thread נתי שטרן
fullcode:



import nilearn.plotting as plot
import os,gzip,io
import nibabel as nib
path="C:/users/administrator/desktop/nii"
path2="C:/users/administrator/desktop/nii/out/"
for i in os.listdir(path):
if(".nii.gz" in i):
pass
else:

if(".nii" in i):
img = nib.load(path+"/"+i)
data = img.get_fdata()
print(data)
import imageio
X=0
for s in data:
import numpy
aleph=numpy.array(s,dtype=numpy.int8)
X=X+1
plot.plot_img(aleph)

imageio.imwrite("C:\\users\\administrator\\desktop\\nii\\"+i
+str(X)+'.jpg', s)






error:
Data given cannot be loaded because it is not compatible with nibabel
format

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


Re: TENGO PROBLEMAS AL INSTALAR PYTHON

2022-07-08 Thread Igor Korot
Hi,

On Fri, Jul 8, 2022 at 2:54 PM ANGIE ODETTE LIMA BANGUERA
 wrote:
>
> buenos dias necesito ayuda, tengo problemas al momento de instalar python
> 10.0 en la aplicación de visual studio code

Can you please describe what the problem is?
Which python are you trying to install? Where did you get it from?
Also - what platform are you using - Windows? Mac? *nix? Which version?

Please post the error if you can't express it in words...

Thank you.

> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: NILEARN - WHY THIS CODE THROWS AN ERROR?????

2022-07-08 Thread MRAB

On 08/07/2022 14:06, נתי שטרן wrote:

fullcode:



import nilearn.plotting as plot
import os,gzip,io
import nibabel as nib
path="C:/users/administrator/desktop/nii"
path2="C:/users/administrator/desktop/nii/out/"
for i in os.listdir(path):
 if(".nii.gz" in i):
 pass
 else:

 if(".nii" in i):
 img = nib.load(path+"/"+i)
 data = img.get_fdata()
 print(data)
 import imageio
 X=0
 for s in data:
 import numpy
 aleph=numpy.array(s,dtype=numpy.int8)
 X=X+1
 plot.plot_img(aleph)

 imageio.imwrite("C:\\users\\administrator\\desktop\\nii\\"+i
+str(X)+'.jpg', s)






error:
Data given cannot be loaded because it is not compatible with nibabel
format



What's the complete traceback?

It might help you to identify the problem if you add messages to tell 
you what it's doing, e.g. what file it's about to load.


Apparently, one of the files is not compatible with nibabel.
--
https://mail.python.org/mailman/listinfo/python-list


Re: TENGO PROBLEMAS AL INSTALAR PYTHON

2022-07-08 Thread Mats Wichmann
On 7/8/22 14:15, Igor Korot wrote:
> Hi,
> 
> On Fri, Jul 8, 2022 at 2:54 PM ANGIE ODETTE LIMA BANGUERA
>  wrote:
>>
>> buenos dias necesito ayuda, tengo problemas al momento de instalar python
>> 10.0 en la aplicación de visual studio code
> 
> Can you please describe what the problem is?
> Which python are you trying to install? Where did you get it from?
> Also - what platform are you using - Windows? Mac? *nix? Which version?
> 
> Please post the error if you can't express it in words...
> 
> Thank you.
> 

In addition... there is no "Python 10.0" ...

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


Re: NILEARN - WHY THIS CODE THROWS AN ERROR?????

2022-07-08 Thread Avi Gross via Python-list
Nati Stern has asked several questions here, often about relatively technical 
uses of python code that many of us have never used and still is not providing 
more exact info that tends to be needed before anyone can even think of 
diagnosing the problem.

I have learned to stay away from some such questioners. But I am wondering if 
some people (others too) think this forum is a generalized help desk staffed by 
College Professors with nothing else to do.

Many questions are best handled locally where people can look over your 
shoulder or use the same software and may have some fluency in your native 
language. And sometimes you need to do more investigating on your own, and 
perhaps tell us what you tried and why it was not useful, or we end up making 
endless suggestions and being told we are not working on your real issue and so 
on.

The code below is just babel or maybe babble. Something nested in a loop had a 
problem. Why not try something drastic and look at the  files and PICK ONE and 
use it step by step and see when it fails?

It looks like the code wants to ask for all files then ignore some. 

Why you would import numpy repeatedly in a loop is beyond me! LOL!

But which command line failed? My GUESS is:

data = img.get_fdata()


If so, did you try to see the current value of the filename you call "i" in the 
loop and see what name was loaded in what looks like a file ending in .nii in 
this code:

img = nib.load(path+"/"+i)


You need to proceed step by step and see if any previous steps failed. 
But what is possible is you got a file with .nii in middle of the name that 
does not end in .gz, or is not in the format needed.
Good luck,
אבי גרוס

-Original Message-
From: MRAB 
To: python-list@python.org
Sent: Fri, Jul 8, 2022 4:47 pm
Subject: Re: NILEARN - WHY THIS CODE THROWS AN ERROR?

On 08/07/2022 14:06, נתי שטרן wrote:
> fullcode:
> 
> 
> 
> import nilearn.plotting as plot
> import os,gzip,io
> import nibabel as nib
> path="C:/users/administrator/desktop/nii"
> path2="C:/users/administrator/desktop/nii/out/"
> for i in os.listdir(path):
>      if(".nii.gz" in i):
>          pass
>      else:
> 
>          if(".nii" in i):
>              img = nib.load(path+"/"+i)
>              data = img.get_fdata()
>              print(data)
>              import imageio
>              X=0
>              for s in data:
>                  import numpy
>                  aleph=numpy.array(s,dtype=numpy.int8)
>                  X=X+1
>                  plot.plot_img(aleph)
> 
>                  imageio.imwrite("C:\\users\\administrator\\desktop\\nii\\"+i
> +str(X)+'.jpg', s)
> 
> 
> 
> 
> 
> 
> error:
> Data given cannot be loaded because it is not compatible with nibabel
> format
> 

What's the complete traceback?

It might help you to identify the problem if you add messages to tell 
you what it's doing, e.g. what file it's about to load.

Apparently, one of the files is not compatible with nibabel.
-- 
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: TENGO PROBLEMAS AL INSTALAR PYTHON

2022-07-08 Thread Martin Di Paola




On Fri, Jul 08, 2022 at 04:15:35PM -0600, Mats Wichmann wrote:


In addition... there is no "Python 10.0" ...



Mmm, perhaps that's the problem :D

@Angie Odette Lima Banguera, vamos a necesitar algun traceback o algo
para guiarte. Podes tambien buscar en internet (youtube) q hay varios
tutoriales para los primeros pasos.

Good luck!
--
https://mail.python.org/mailman/listinfo/python-list


Re: NILEARN - WHY THIS CODE THROWS AN ERROR?????

2022-07-08 Thread MRAB

On 08/07/2022 23:20, Avi Gross via Python-list wrote:

Nati Stern has asked several questions here, often about relatively technical 
uses of python code that many of us have never used and still is not providing 
more exact info that tends to be needed before anyone can even think of 
diagnosing the problem.

I have learned to stay away from some such questioners. But I am wondering if 
some people (others too) think this forum is a generalized help desk staffed by 
College Professors with nothing else to do.

Many questions are best handled locally where people can look over your 
shoulder or use the same software and may have some fluency in your native 
language. And sometimes you need to do more investigating on your own, and 
perhaps tell us what you tried and why it was not useful, or we end up making 
endless suggestions and being told we are not working on your real issue and so 
on.

The code below is just babel or maybe babble. Something nested in a loop had a 
problem. Why not try something drastic and look at the  files and PICK ONE and 
use it step by step and see when it fails?

It looks like the code wants to ask for all files then ignore some.

Why you would import numpy repeatedly in a loop is beyond me! LOL!

But which command line failed? My GUESS is:

data = img.get_fdata()


If so, did you try to see the current value of the filename you call "i" in the 
loop and see what name was loaded in what looks like a file ending in .nii in this code:

img = nib.load(path+"/"+i)


You need to proceed step by step and see if any previous steps failed.
But what is possible is you got a file with .nii in middle of the name that 
does not end in .gz, or is not in the format needed.


Indeed, it writes JPEG files whose filename contains the original 
filename (with the ".nii") into the same folder, so if it has already 
been run and produced an output file, the next time it's run, it'll trip 
itself up.


All this would've been clear to the OP if it had printed messages as it 
went.



Good luck,
אבי גרוס

-Original Message-
From: MRAB 
To: python-list@python.org
Sent: Fri, Jul 8, 2022 4:47 pm
Subject: Re: NILEARN - WHY THIS CODE THROWS AN ERROR?

On 08/07/2022 14:06, נתי שטרן wrote:

fullcode:



import nilearn.plotting as plot
import os,gzip,io
import nibabel as nib
path="C:/users/administrator/desktop/nii"
path2="C:/users/administrator/desktop/nii/out/"
for i in os.listdir(path):
      if(".nii.gz" in i):
          pass
      else:

          if(".nii" in i):
              img = nib.load(path+"/"+i)
              data = img.get_fdata()
              print(data)
              import imageio
              X=0
              for s in data:
                  import numpy
                  aleph=numpy.array(s,dtype=numpy.int8)
                  X=X+1
                  plot.plot_img(aleph)

                  imageio.imwrite("C:\\users\\administrator\\desktop\\nii\\"+i
+str(X)+'.jpg', s)






error:
Data given cannot be loaded because it is not compatible with nibabel
format



What's the complete traceback?

It might help you to identify the problem if you add messages to tell
you what it's doing, e.g. what file it's about to load.

Apparently, one of the files is not compatible with nibabel.


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


Re: NILEARN - WHY THIS CODE THROWS AN ERROR?????

2022-07-08 Thread Chris Angelico
On Sat, 9 Jul 2022 at 10:57, MRAB  wrote:
>
> On 08/07/2022 23:20, Avi Gross via Python-list wrote:
> > Nati Stern has asked several questions here, often about relatively 
> > technical uses of python code that many of us have never used and still is 
> > not providing more exact info that tends to be needed before anyone can 
> > even think of diagnosing the problem.
> >
> > I have learned to stay away from some such questioners. But I am wondering 
> > if some people (others too) think this forum is a generalized help desk 
> > staffed by College Professors with nothing else to do.
> >
> > Many questions are best handled locally where people can look over your 
> > shoulder or use the same software and may have some fluency in your native 
> > language. And sometimes you need to do more investigating on your own, and 
> > perhaps tell us what you tried and why it was not useful, or we end up 
> > making endless suggestions and being told we are not working on your real 
> > issue and so on.
> >
> > The code below is just babel or maybe babble. Something nested in a loop 
> > had a problem. Why not try something drastic and look at the  files and 
> > PICK ONE and use it step by step and see when it fails?
> >
> > It looks like the code wants to ask for all files then ignore some.
> >
> > Why you would import numpy repeatedly in a loop is beyond me! LOL!
> >
> > But which command line failed? My GUESS is:
> >
> > data = img.get_fdata()
> >
> >
> > If so, did you try to see the current value of the filename you call "i" in 
> > the loop and see what name was loaded in what looks like a file ending in 
> > .nii in this code:
> >
> > img = nib.load(path+"/"+i)
> >
> >
> > You need to proceed step by step and see if any previous steps failed.
> > But what is possible is you got a file with .nii in middle of the name that 
> > does not end in .gz, or is not in the format needed.
>
> Indeed, it writes JPEG files whose filename contains the original
> filename (with the ".nii") into the same folder, so if it has already
> been run and produced an output file, the next time it's run, it'll trip
> itself up.
>
> All this would've been clear to the OP if it had printed messages as it
> went.

Or if the OP had renamed them all to "shrubbery" along the way.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list