Re: PYTHON GDAL

2017-05-23 Thread dieter
jorge.conr...@cptec.inpe.br writes: > ... > and I had: > > import gdal > Traceback (most recent call last): > ... > line 17, in swig_import_helper > _mod = imp.load_module('_gdal', fp, pathname, description) > ImportError: libicui18n.so.56: cannot open shared object file: No such > file or dire

Re: PYHDF

2017-05-23 Thread dieter
jorge.conr...@cptec.inpe.br writes: > I downloade the pyhdf-0.9.0 and install it. Then I did: > > from pyhdf.SD import SD, SDC > > and I had: > > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named pyhdf.SD The error tells you that there is a "pyhdf" module/

Re: Passing yield as a function argument...

2017-05-23 Thread Peter Otten
Christopher Reimer wrote: > Greetings, > > I have two functions that I generalized to be nearly identical except > for one line. One function has a yield statement, the other function > appends to a queue. > > If I rewrite the one line to be a function passed in as an argument -- > i.e., func(da

Verifiably better, validated Enum for Python

2017-05-23 Thread breamoreboy
Well that's what is says here https://github.com/ofek/venum so it must be true. Please move over Ethan, your time is up :-) Kindest regards. Mark Lawrence. -- https://mail.python.org/mailman/listinfo/python-list

Re: Concatenating files in order

2017-05-23 Thread breamoreboy
On Tuesday, May 23, 2017 at 8:29:57 PM UTC+1, Mahmood Naderan wrote: > Hi, > There are some text files ending with _chunk_i where 'i' is an integer. For > example, > > XXX_chunk_0 > XXX_chunk_1 > ... > > I want to concatenate them in order. Thing is that the total number of files > may be varia

Passing yield as a function argument...

2017-05-23 Thread Christopher Reimer
Greetings, I have two functions that I generalized to be nearly identical except for one line. One function has a yield statement, the other function appends to a queue. If I rewrite the one line to be a function passed in as an argument -- i.e., func(data) -- queue.append works fine. If I c

Re: Concatenating files in order

2017-05-23 Thread Tim Chase
On 2017-05-23 13:38, woo...@gmail.com wrote: > It is very straight forward; split on "_", create a new list of > lists that contains a sublist of [file ending as an integer, file > name], and sort > > fnames=["XXX_chunk_0", > "XXX_chunk_10", > "XXX_chunk_1", >

Re: Concatenating files in order

2017-05-23 Thread Cameron Simpson
On 23May2017 21:14, Mahmood Naderan wrote: OK guys thank you very much. It is better to sort them first. Here is what I wrote files = glob.glob('*chunk*') I'd be inclined to go with either '*chunk_*' or just to read the strings from os.listdir, because what you want isn't easily written as

Re: Emacs command to select only lines indented below a specified level

2017-05-23 Thread Ben Finney
Ben Finney writes: > E.g.: > > M-9 C-x $ # Indentation >= 9 disappears. > C-u C-x $ # Indentation >= 4 disappears. > C-u 1 3 C-x $ # Indentation >= 13 disappears. > C-u C-u C-u $ # Indentation >= 64 disappears. > C-x $ # All lines reapp

Emacs command to select only lines indented below a specified level (was: Scala considering significant indentation like Python)

2017-05-23 Thread Ben Finney
Fred Stluka writes: > On 5/23/17 4:43 PM, Ben Finney wrote: > > > The ‘set-selective-display’ command […] is bound to ‘C-x $’ in > > default Emacs. > > How do I specify the number of columns when using "C-x $"? You will remember, from doing the Emacs tutorial when you first learned Emacs, that a

Re: Concatenating files in order

2017-05-23 Thread Erik
On 23/05/17 22:14, Mahmood Naderan via Python-list wrote: sorted=[[int(name.split("_")[-1]), name] for name in files] This isn't sorting anything. At no point do you invoke a sort operation. It's processing the list in the original order and generating a new list with a different format but *

Re: Concatenating files in order

2017-05-23 Thread MRAB
On 2017-05-23 22:14, Mahmood Naderan via Python-list wrote: OK guys thank you very much. It is better to sort them first. Here is what I wrote files = glob.glob('*chunk*') Here you're making a list of (index, name) pairs: sorted=[[int(name.split("_")[-1]), name] for name in files] but y

Re: Scala considering significant indentation like Python

2017-05-23 Thread Fred Stluka
On 5/23/17 4:43 PM, Ben Finney wrote: The ‘set-selective-display’ command will collapse the current buffer's text to lines indented to the specified number of columns; the same command with no argument will expand the buffer to normal again. The command is bound to ‘C-x $’ in default Emacs. Ben

Re: Concatenating files in order

2017-05-23 Thread Mahmood Naderan via Python-list
OK guys thank you very much. It is better to sort them first. Here is what I wrote files = glob.glob('*chunk*') sorted=[[int(name.split("_")[-1]), name] for name in files] with open('final.txt', 'w') as outf: for fname in sorted: with open(fname[1]) as inf: for line in

Re: Concatenating files in order

2017-05-23 Thread Tim Chase
On 2017-05-23 19:29, Mahmood Naderan via Python-list wrote: > There are some text files ending with _chunk_i where 'i' is an > integer. For example, > > XXX_chunk_0 > XXX_chunk_1 > ... > > I want to concatenate them in order. Thing is that the total number > of files may be variable. Therefore, I

Re: Concatenating files in order

2017-05-23 Thread bartc
On 23/05/2017 20:55, Rob Gaddi wrote: Yup. Make a list of all the file names, write a key function that extracts the numbery bits, sort the list based on that key function, and go to town. Is it necessary to sort them? If XXX is known, then presumably the first file will be called XXX_chunk_

Re: Scala considering significant indentation like Python

2017-05-23 Thread Ben Finney
Grant Edwards writes: > On 2017-05-23, Michael Torrie wrote: > > Sometimes things get longer than a page (like a class definition). > > A nice folding mode works nicely for that sort of thing. I normally > use emacs, but it doesn't seem to have a folding mode built-in, and > the add-on one's I'v

Re: Concatenating files in order

2017-05-23 Thread woooee
It is very straight forward; split on "_", create a new list of lists that contains a sublist of [file ending as an integer, file name], and sort fnames=["XXX_chunk_0", "XXX_chunk_10", "XXX_chunk_1", "XXX_chunk_20", "XXX_chunk_2"] sorted_lis

Re: Concatenating files in order

2017-05-23 Thread MRAB
On 2017-05-23 21:16, Mahmood Naderan via Python-list wrote: Yup. Make a list of all the file names, write a key function that extracts the numbery bits, sort the list based on that key function, and go to town. Alternatively, when you create the files in the first place, make sure to use mor

Re: Concatenating files in order

2017-05-23 Thread Grant Edwards
On 2017-05-23, Mahmood Naderan via Python-list wrote: > import glob; > for f in glob.glob('*chunk*'): > print(f) > > it will print in order. Is that really sorted or it is not guaranteed? https://docs.python.org/2/library/glob.html https://docs.python.org/3/library/glob.html It's in the f

Re: Concatenating files in order

2017-05-23 Thread Mahmood Naderan via Python-list
>Yup. Make a list of all the file names, write a key function that >extracts the numbery bits, sort the list based on that key function, and >go to town. > >Alternatively, when you create the files in the first place, make sure >to use more leading zeros than you could possibly need. >xxx_chun

Re: Concatenating files in order

2017-05-23 Thread Rob Gaddi
On 05/23/2017 12:37 PM, breamore...@gmail.com wrote: On Tuesday, May 23, 2017 at 8:29:57 PM UTC+1, Mahmood Naderan wrote: Hi, There are some text files ending with _chunk_i where 'i' is an integer. For example, XXX_chunk_0 XXX_chunk_1 ... I want to concatenate them in order. Thing is that the

Concatenating files in order

2017-05-23 Thread Mahmood Naderan via Python-list
Hi, There are some text files ending with _chunk_i where 'i' is an integer. For example, XXX_chunk_0 XXX_chunk_1 ... I want to concatenate them in order. Thing is that the total number of files may be variable. Therefore, I can not specify the number in my python script. It has to be "for all

Building a PDF from Byte-of-Python

2017-05-23 Thread ElChino
I'd like to know how to create a 'Byte-of-Python.PDF' from the *.md sources at: https://github.com/swaroopch/byte-of-python I'm not sure how to do this since that page doesn't mention it AFAICS. Is 'sphinx-build' the way to do it? If so, how? -- https://mail.python.org/mailman/listinfo/python-

Re: SSL certificate of a server on Windows

2017-05-23 Thread Irmen de Jong
On 23-5-2017 10:19, COPIN Mathieu. wrote: > Hi, > > I want to get a server certificate from the host-name. > > I know I could do something like : >> call(openssl, s_client, -showcerts, -connect, hostname:port) > > > But the thing is to do it without openssl because I want to run the script on

PYTHON GDAL

2017-05-23 Thread jorge . conrado
Hi, I'm trying to run a script to read and plot an geotiff data. And I use: import gdal and I had: import gdal Traceback (most recent call last): File "", line 1, in File "/home/conrado/miniconda2/lib/python2.7/site-packages/gdal.py", line 2, in from osgeo.gdal import deprecation

PYHDF

2017-05-23 Thread jorge . conrado
Hi, I downloade the pyhdf-0.9.0 and install it. Then I did: from pyhdf.SD import SD, SDC and I had: Traceback (most recent call last): File "", line 1, in ImportError: No module named pyhdf.SD I have a script to read and plot MODIS data and it use the from pyhdf.SD import SD, SDC. Wha

Re: Scala considering significant indentation like Python

2017-05-23 Thread justin walters
On Tue, May 23, 2017 at 7:10 AM, Grant Edwards wrote: > On 2017-05-23, Michael Torrie wrote: > > On 05/22/2017 02:57 PM, Ethan Furman wrote: > >>> Kind of reminds me of LISP. Lots of closing parenths, and often then > >>> just all get stuck together on a long. But I guess that's why they > >>>

Re: Scala considering significant indentation like Python

2017-05-23 Thread Grant Edwards
On 2017-05-23, Michael Torrie wrote: > On 05/22/2017 02:57 PM, Ethan Furman wrote: >>> Kind of reminds me of LISP. Lots of closing parenths, and often then >>> just all get stuck together on a long. But I guess that's why they >>> invented paren matching shortcuts in editors. To make it easy to

SSL certificate of a server on Windows

2017-05-23 Thread COPIN Mathieu.
Hi, I want to get a server certificate from the host-name. I know I could do something like : > call(openssl, s_client, -showcerts, -connect, hostname:port) But the thing is to do it without openssl because I want to run the script on Windows. Any suggestions ? Mathieu -- https://mail.pytho