Re: Something wrong with the PIP, lots of friend have the same problem

2016-08-25 Thread Piet van Oostrum
. What command did you use and what was the result? [Maybe you tried to include images in your post/mail but they did not come through. Just copy/paste the text.] -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: [python-committers] [RELEASE] Python 3.6.0b1 is now available

2016-09-14 Thread Guido van Rossum
__ > python-committers mailing list > python-committ...@python.org > https://mail.python.org/mailman/listinfo/python-committers > Code of Conduct: https://www.python.org/psf/codeofconduct/ -- --Guido van Rossum (python.org/~guido) -- https://mail.python.org/mailman/listinfo/python-list

Re: Expression can be simplified on list

2016-09-17 Thread Piet van Oostrum
n be simplified to just: if errors: This is quite usual in Python, but some people prefer the more elaborate form, or something like: if len(errors) == 0: -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: how to automate java application in window using python

2016-09-28 Thread Emile van Sebille
On 09/23/2016 05:02 PM, Lawrence D’Oliveiro wrote: On Thursday, September 22, 2016 at 8:34:20 AM UTC+12, Emile wrote: Hmm, then I'll have to wait longer to experience the unreliability as the handful of automated gui tools I'm running has only been up 10 to 12 years or so. You sound like you h

Re: how to automate java application in window using python

2016-09-28 Thread Emile van Sebille
On 09/28/2016 02:52 PM, Lawrence D’Oliveiro wrote: On Thursday, September 29, 2016 at 4:57:10 AM UTC+13, Emile van Sebille wrote: My point was that it is possible to automate windows reliably as long as the programming is robust. Sounds like circular reasoning. Which worked for me! You

Re: working with ctypes and complex data structures

2016-10-05 Thread Emile van Sebille
On 10/05/2016 01:06 PM, Michael Felt wrote: On 02-Oct-16 19:50, Michael Felt wrote: I am trying to understand the documentation re: ctypes and interfacing with existing libraries. I am reading the documentation, and also other sites that have largely just copied the documentation - as well as

Re: Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread Emile van Sebille
On 10/10/2016 09:25 AM, Nuen9 wrote: Hi! Could it be, "Nuen9", that you would like to find a split where the split sums are close to each other? In other words, you define the number of splits (in your example: 3) and the algortihm should test all possible combinations and select the split where

Re: Working around multiple files in a folder

2016-11-21 Thread Emile van Sebille
On 11/21/2016 11:27 AM, subhabangal...@gmail.com wrote: I have a python script where I am trying to read from a list of files in a folder and trying to process something. As I try to take out the output I am presently appending to a list. But I am trying to write the result of individual files

Re: [Python-Dev] [RELEASE] Python 2.7.15

2018-05-01 Thread Guido van Rossum
.org/mailman/listinfo/python-dev > > Unsubscribe: https://mail.python.org/mailman/options/python-dev/tritium- > > list%40sdamon.com > > ___ > Python-Dev mailing list > python-...@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ > guido%40python.org > -- --Guido van Rossum (python.org/~guido) -- https://mail.python.org/mailman/listinfo/python-list

Re: PyDocs Arabic Translation Started and Call to Interested Parties viz en-ar Speakers

2018-07-19 Thread Guido van Rossum
Thank you for taking the lead and good luck with the project! On Wed, Jul 18, 2018 at 11:57 PM Abdur-Rahmaan Janhangeer < arj.pyt...@gmail.com> wrote: > Greetings everybody, > > i take this opportunity to announce to the python community that Arabic > translations for the docs have started at > >

Re: Facing an Error after migrating from python 3.4.1 to python 3.6.6 ( Failed to import the site module )

2018-12-28 Thread Piet van Oostrum
` > After migrating from python 3.4.1 to python 3.6.6 > while Executing my project, I'm facing this issue and not able to > resolve it. Can i get any solution for this issue? Could it be that your PYTHONPATH environment variable is set to a directory i

How to display video files (mkv, wav, mp4 etc) within a TKinter widget?

2019-01-02 Thread Arie van Wingerden
I found (mostly fairly old stuff) some questions and a lot of (apparently often not working) Python code. 1. does TKinter offer such thing out of the box? 2. or is there another way using TKinter? 3. or do I need another GUI tool (e.g. QT) for this? TIA -- https://mail.python.org/mailman/listin

Re: How to display video files (mkv, wav, mp4 etc) within a TKinter widget?

2019-01-03 Thread Arie van Wingerden
ande Vyvre: > Le 2/01/19 à 15:17, Arie van Wingerden a écrit : > > I found (mostly fairly old stuff) some questions and a lot of (apparently > > often not working) Python code. > > > > 1. does TKinter offer such thing out of the box? > > 2. or is there another way

Re: Python read text file columnwise

2019-01-11 Thread Piet van Oostrum
('testcsv.csv', newline='') as csvfile: reader = csv.reader(csvfile, delimiter='\t') for row in reader: for i in range(2, 5): row[i] = float(row[i]) print(row) You could convert the first two columns to datetime format if you wish. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

timezones

2019-02-07 Thread Jaap van Wingerde
ndroid JPG-images as the 'Exif.GPSInfo.GPSTimeStamp' and 'Exif.GPSInfo.GPSDateStamp' are missing. Why I get this unrespected results? Kind regards, Jaap. -- Jaap van Wingerde e-mail: 1234567...@vanwingerde.nl -- https://mail.python.org/mailman/listinfo/python-list

Re: timezones

2019-02-08 Thread Jaap van Wingerde
int(est_dt.strftime(fmt) + ' / ' + edt_dt.strftime(fmt)) > 2002-10-27 01:30:00 EDT-0400 / 2002-10-27 01:30:00 EST-0500 > > > Browse through their examples and see if you can find something > similar that works for you. > > > -Original Message- > From

Re: The slash "/" as used in the documentation

2019-02-09 Thread Piet van Oostrum
; f( x; y ) > > (the actual call still would use a comma there). > What are you talking about? What documentation? It seems to me you are talking about a completely different programming language, not python. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: The slash "/" as used in the documentation

2019-02-09 Thread Piet van Oostrum
ce. > > Christian Even simpler: >>> help(len) help(len) Help on built-in function len in module builtins: len(obj, /) Return the number of items in a container. both in python 3.6 and 3.7. This is weird. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert a list with wrong encoding to utf8

2019-02-15 Thread Piet van Oostrum
o to get the names?! python3 >>> x = '\xce\x86\xce\xba\xce\xb7\xcf\x82 >>> \xce\xa4\xcf\x83\xce\xb9\xce\xac\xce\xbc\xce\xb7\xcf\x82' >>> b = bytes(ord(c) for c in x) >>> b.decode('utf-8') 'Άκης Τσιάμης' >>> -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: WebScrapping

2019-02-19 Thread Piet van Oostrum
ainer.find('div', attrs={'class':'item-branding'}) > price = container.find('div', attrs={'class':'item-action'}) > records.append((brand, price)) > When I put this in a python file, and run it under python3.7, it work

Re: Testing the data type of a value

2019-05-12 Thread Piet van Oostrum
t(int) The value of int is the class int, which is the class of 5, so type(5) is also that same class int. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Import module from a different subdirectory

2019-05-18 Thread Piet van Oostrum
hat model.py wasn't found in classes, i.e. it was the same error as Peter got. So to get this working you must make sure 'classes' is inside a directory that is in sys.path, for example by adding: sys.path.insert(0, '..') -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Why is augmented assignment of a tuple with iterable unpacking invalid syntax?

2019-05-19 Thread Piet van Oostrum
the y is basically part of an expression. But starred expressions are not allowed in expressions, except within explicit parentheses. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: pandas loc on str lower for column comparison

2019-08-29 Thread Piet van Oostrum
27;New Team')] And than it should work. Except that the str.replace is wrong for what you want. It just replaces the literal string "s/+" with an empty string instead of white space. This was wrong in the stackoverflow post. To replace whitespace it should be str.replace(

Re: pandas loc on str lower for column comparison

2019-08-29 Thread Piet van Oostrum
Piet van Oostrum writes: > So the correct way to do this is to make df1 a copy rather than a view. > > df1 = df.loc[:, ('UID','Name','New Leader','Current Team', 'New Team')] Or maybe even make an explicit copy: df1 = df[['UID&#

Re: pandas loc on str lower for column comparison

2019-08-30 Thread Piet van Oostrum
oc['New Team'].str.lower().str.strip() > > But on both occasions I receive this error. > > # KeyError: 'the label [Current Team] is not in the [index]' > > if I test df1 before trying to create the new column it works just fine. > > Sayth What

Re: open, close

2019-08-31 Thread Piet van Oostrum
t there is no guarantee. It depends on garbage collection. In your case the file will not be closed as long as there is still a reference to it (as in f). When f disappears and all copies of it as well, the file COULD be closed similarly. On the other hand, the with statement guarantees that

Re: pandas loc on str lower for column comparison

2019-08-31 Thread Piet van Oostrum
at 'Current Team' is spelled differently in the assignment than in the construction of df1? For example a difference in spaces, like a triling space or a breaking vs. non-breaking space? Please check that both are exactly the same. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/

Re: ``if var'' and ``if var is not None''

2019-09-01 Thread Piet van Oostrum
;) False In [3]: if var is not None: ...: print('True') ...: else: ...: print('False') True -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: IDLE missing !

2019-09-01 Thread Piet van Oostrum
I couldn’d find the IDLE shell > with them. Well, on MacOS 10.13.6 (High Sierra) tensorflow 1.14.0 does install on Python 3.7.4, and it also runs. It does give some warnings about deprecations, however. There is also a version 2.0RC which installs and runs without warnings. -- Piet van

Re: pandas loc on str lower for column comparison

2019-09-05 Thread Piet van Oostrum
grab all columns 13 when I requested 5. > UID Name FTE Agent ID Current Leader New Leader Current Team New > Team Current Site New Site Unnamed: 10 Unnamed: 11 Unnamed: 12 > > How do I misunderstand iloc? > That would select ROWS 0,1,5,6,7, not columns. To select columns 0,1,5,6

Re: pandas loc on str lower for column comparison

2019-09-05 Thread Piet van Oostrum
Piet van Oostrum writes: > That would select ROWS 0,1,5,6,7, not columns. > To select columns 0,1,5,6,7, use two-dimensional indexes > > df1 = df.iloc[:, [0,1,5,6,7]] > > : selects all rows. And that also solves your original problem. This statement: df1['Difference&#x

Re: issue in handling CSV data

2019-09-10 Thread Piet van Oostrum
actually treated this as a CSV file. 2) As I said above, if you choose ',' as separator, these will disappear. Similarly, if you choose TAB as seperator, the TABs will disappear. As the format is a strange mixture of the two, you can use either one. But if it would be read with a real

Re: numpy array - convert hex to int

2019-09-10 Thread Piet van Oostrum
') > 27 > ---> 28 my_data_3 = int(my_data_2) > 29 > 30 my_data_4 = my_data_3.astype(np.float) > TypeError: only length-1 arrays can be converted to Python scalars > # >>> my_data_2 = numpy.array(['0a&#

Re: phyton

2019-09-10 Thread Piet van Oostrum
print(add_vat(101, 'low')) > > Outcome: > > 122.21 > 110.09 > > Thanks! You could use a dictionary to connect the words to the values. As this is homework you have to do it yourself. Learn about dictionaries. Otherwise just use 'if'. -- Piet van

Re: pandas loc on str lower for column comparison

2019-09-10 Thread Piet van Oostrum
gt; Confused > > Sayth df1['Difference'] = df1['Current Team'].str.lower().str.strip() == df1['New Team'].str.lower().str.strip() works on whole columns, not only on an individual row. xls = pd.ExcelFile("Melbourne.xlsx") df = xls.par

Re: not working

2019-09-17 Thread Piet van Oostrum
gt; |>>> re.search( pattern, '1234' ).group( 1 ) > |IndexError: no such group > |>>> re.search( pattern2, '1234' ).group( 1 ) > |>>> > The second pattern has parentheses, hence a group. The first doesn't. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: python is bugging

2019-09-21 Thread Piet van Oostrum
acility. When a compound statement is entered interactively, it must be followed by a blank line to indicate completion (since the parser cannot guess when you have typed the last line). Note that each line within a basic block must be indented by the same amount. -- Piet van Oostrum WWW: http://piet

Re: python is bugging

2019-09-21 Thread Piet van Oostrum
code the error is on line 15 1) What is line 15? 2) Always copy/paste the complete error message with your question. 3) Your with body is not indented: with fits.open(fits_filename) as data: df=pd.DataFrame(data[1].data) df.columns=[c.lower() for c in df.columns] print(&

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Piet van Oostrum
cation in dataframe before extracting the numeric fields to the > array. > > Please, any comments or tip? data = pd.read_csv ('table.csv', sep = ',', skiprows = 1, decimal=b',', skipinitialspace=True) -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-23 Thread Piet van Oostrum
; I found that it also works without the letter b. > I added the b because the default in the definition of read_csv is b'.', but you are right, it works with just ','. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: CSV reader ignore brackets

2019-09-26 Thread Piet van Oostrum
here is some working code: def PReader(csvfile): import re for line in csvfile: line = re.sub(r'\(.*?\)', '"\g<0>"', line) yield line import csv with open('testcsv.csv') as csvfile: reader = csv.reader(PReader(csvfile), quot

Re: itertools query

2019-09-27 Thread Piet van Oostrum
about (5,7), (5,8) and (6,8)? -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Print to Paper

2019-10-04 Thread Piet van Oostrum
d probably want to generate a PDF file and send that to the printer, possibly with the use of LaTeX. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange tab completion oddity with enums?

2019-10-07 Thread Piet van Oostrum
at's going on? >>> Foo.__abstractmethods__ Traceback (most recent call last): File "", line 1, in AttributeError: __abstractmethods__ -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Jupyter Notebook -> PDF with A4 pages?

2019-10-13 Thread Piet van Oostrum
you prefer that. You can leave out the c.LatexExporter.template_file line if you don't want the LaTeX exporter to generate A4. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Jupyter Notebook -> PDF with A4 pages?

2019-10-15 Thread Piet van Oostrum
Martin Schöön writes: > Den 2019-10-13 skrev Piet van Oostrum : >> Martin Schöön writes: >> >>> Is there a way to do "Download as PDF" and get A4 pages instead >>> of Letter? Yes, I know I can do "Download as LaTeX" and edit the >> >

Re: Hello, I need help.

2019-10-15 Thread Piet van Oostrum
hat is called IDLE. It is simpler than Pycharm, but it can do the job. So you can try that. If that also gives an error you could try to reinstall Python. If you are familiar with the command line, then that is also a possibility. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8D

Re: Instantiating sub-class from super

2019-10-16 Thread Piet van Oostrum
n making hasty subdivisions. In this context that means attributes (that can be None) rather than subclasses. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Jupyter Notebook -> PDF with A4 pages?

2019-10-16 Thread Piet van Oostrum
Martin Schöön writes: > Den 2019-10-15 skrev Piet van Oostrum : >> >> What does this report? Compare if there is a difference between home and >> work. >> >> from jupyter_core.paths import jupyter_path >> print(jupyter_path('notebook','

Re: Convert a scientific notation to decimal number, and still keeping the data format as float64

2019-10-20 Thread Piet van Oostrum
doganad...@gmail.com writes: > > In the meanwhile I have checked Scala , and it's more limited then Python. > As an example: > 0.0001 > 1.0E-4: Double > Why do you think this means Scala is more limited than Python? -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP

Re: Convert a scientific notation to decimal number, and still keeping the data format as float64

2019-10-21 Thread Piet van Oostrum
rs of the language, not characteristics of the language itself. -- Pieter van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert a scientific notation to decimal number, and still keeping the data format as float64

2019-10-21 Thread Piet van Oostrum
Piet van Oostrum writes: > doganad...@gmail.com writes: > >> I dont know much about scala actually. I have just have tried to give >> 0.0001 and it returned a presentation with an 'e' .whereas python takes >> 0.0001 and gives 0.0001 . it made me think python is

Fwd: permission denied using python 3.8

2019-11-04 Thread Francois van Lieshout
Outlook voor Android downloaden<https://aka.ms/ghei36> ________ Van: Francois van Lieshout Verstuurd: maandag 4 november 2019 18:19 Aan: python-list@python.org Onderwerp: permission denied using python 3.8 Hi, i installed python 3.8 the latest version but it d

Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-05 Thread Pieter van Oostrum
In [8]: class MA(type): ...: def __instancecheck__(cls, inst): ...: print ("MA", cls, inst) ...: ...: class AM(list, metaclass = MA): pass ...: class AM2(AM): pass ...: ...: am = AM2() In [9]: isinstance(am, AM) MA [] Out[9]: False -- Pieter van Oostrum WW

Re: Funny behavior of IDLE 3.7.0

2019-11-12 Thread Pieter van Oostrum
fication (:...). {i=} is not a correct expression. When you remove the »f«, it becomes a normal string, where the {} don't have a special meaning. -- Pieter van Oostrum WWW: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: nonlocal fails ?

2019-11-15 Thread Pieter van Oostrum
t is called from Func2, it uses MyVar from Func2? If that is what you mean, that would be dynamic scope. -- Pieter van Oostrum WWW: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-17 Thread Pieter van Oostrum
al characters " ' () [ and $ must be escaped for the shell, and [ and $ also for the regexp. Then it comes down to sed -e s=\"\(\\[^/]+\)\\$\"=\'\(\[^/]+\)\$\'= file -- Pieter van Oostrum WWW: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-17 Thread Pieter van Oostrum
Pieter van Oostrum writes: > It isn't that difficult with sed, only you have to chose a different > character than / in the substitute command, one that is not present in > both texts, e.g instead of s/a/b/ use s=a=b=. > > And then the special characters " ' () [

Re: revise "([^/]+)$" into '([^/]+)$' in a lot of files under a directory.

2019-11-18 Thread Pieter van Oostrum
Hongyi Zhao writes: > On Sun, 17 Nov 2019 20:28:55 +0100, Pieter van Oostrum wrote: > >> To be honest, I myself would use Emacs, with rgrep and wgrep to do this. > > Are these tools superior to grep? They are based on grep. But rgrep does a grep through a whole directory tre

Re: Global variable is undefined at the module level

2019-11-23 Thread Pieter van Oostrum
; testfunc() >>> globvar Traceback (most recent call last): File "", line 1, in NameError: name 'globvar' is not defined >>> def testfunc(): ... global globvar ... globvar = 1 ... >>> globvar Traceback (most recent call last): File

Re: os.system vs subrocess.call

2019-11-28 Thread Pieter van Oostrum
#x27;], shell=True) > > I get > > Test.py: 1: Test.py: ./: Permission denied > Why would you do that, splitting './Test.py' in two parts? That doesn't work. > Is there a simple way to use subprocess in this usecase? > subprocess.call(['./Test.py']) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: INHERITANCE in python3

2019-12-19 Thread Pieter van Oostrum
p.family)``` Please next time, supply a properly indented Python source, with only normal ASCII spaces, not no-break spaces, i.e. exactly like in your Python source code. > > The Username class also needs to call super(). In general, super() is > intended to be used with all classes that

Re: hexdump module installation error

2019-12-19 Thread Pieter van Oostrum
> > user@USERnoMacBook-Air LibraBrowser % Could it be that your pip3 belongs to a different Python than the one above (for example a Python 3.8 or 3.6)? What is the output of 'pip3 --version' (without quotes)? -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8D

Re: urllib unqoute providing string mismatch between string found using os.walk (Python3)

2019-12-21 Thread Pieter van Oostrum
character, Unicode 0xF3, LATIN SMALL LETTER O WITH ACUTE. In (a) it is composed of the letter o and the accent "́" (Unicode 0x301). So you would have to do Unicode normalisation before comparing. For example: In [16]: from unicodedata import normalize In [17]: a == b Out[17]: False

Re: [ANN] Retrospective of Python compilation efforts

2019-12-24 Thread Guido van Rossum
gt; -- > Python-announce-list mailing list -- python-announce-l...@python.org > To unsubscribe send an email to python-announce-list-le...@python.org > https://mail.python.org/mailman3/lists/python-announce-list.python.org/ > > Support the Python Software Foundation: > h

Re: name 'sys' is not defined

2019-12-30 Thread Pieter van Oostrum
he name sys is used in the imported module, that module has to import sys. Importing it in the calling code doesn't help. So I would say this is a bug in the module. You should report the bug to its author. In the meantime you can correct your own copy at ~/opt/miniconda3/envs/py3/

Re: looking for git with a solution - merge many pdfs to 1 pdf (no matter what language)

2020-01-08 Thread Pieter van Oostrum
alon.naj...@gmail.com writes: > hi > looking for git with a solution - merge many pdfs to 1 pdf (no matter what > language) There is a clone of pdftk on github: https://github.com/ericmason/pdftk Another possibility is mupdf: http://git.ghostscript.com/?p=mupdf.git -- Pieter van Oo

Re: I need to create .odt or .rtf documents in Python3. what is the best tool to do this....

2020-01-12 Thread Pieter van Oostrum
anyone have any suggestions? > > chris https://github.com/eea/odfpy -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Relative import cannot find .so submodule?

2020-01-13 Thread Pieter van Oostrum
the import system. Are you running python 3.6? I tried this on python 3.7 and it worked, but the file is called _rtmidi.cpython-37m-darwin.so there (37 for python3.7, and the d is missing, I don't know what that indicates). -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: How to compare in python an input value with an hashed value in mysql table?

2020-01-14 Thread Pieter van Oostrum
n the database. Of course this only works if that stored hash has been calculated in the same way from the same key. On Python 2 (which you shouldn't use) you can leave out the "key = bytes(key, 'ascii')" part. You can of course make it more sophisticated, for example by

Re: Help

2020-01-16 Thread Pieter van Oostrum
kiran chawan writes: > Whenever Iam trying to run this 'New latest version python software 3.8.4 > python ' but it doesn't show any install option and it say ' modify set up > ' So tell what to do sir plz help me out. There is no Python 3.8.4

Re: How to compare in python an input value with an hashed value in mysql table?

2020-01-16 Thread Pieter van Oostrum
er file name with open(secretfile, 'rb') as fd: secret = fd.read() key = 'goldQ3T8-1QRD-5QBI-9F22' bkey = key.encode('ascii') h = hmac.new(secret, bkey, hashlib.sha256) print('hd (hex): ', h.hexdigest()) -- Pieter van Oostrum www: http://piet

RE: Python-list Digest, Vol 196, Issue 26

2020-01-26 Thread Francois van Lieshout
for x in range( 0,10 ): stars = "" count = 0 while count < x: stars += "x" count += 1 print( stars ) x xx xxx x xx xxx x You've got already an "x" placed in your variable stars that's why. -O

Re: ÿ in Unicode

2020-03-06 Thread Pieter van Oostrum
t; 'ÿ'.encode('utf-16-le') >>> > b'\xff\x00' >>> >>>> 'ÿ'.encode('utf-32-le') >>> > b'\xff\x00\x00\x00' >> >>> That all looks as expected. >> Yes >> >>>Is there somet

Re: iterate through an irregular nested list in Python

2020-03-06 Thread Pieter van Oostrum
' else: yield from reclist(item) else: yield item for i in reclist(aList): print(i, end=',') This gives you an extra comma at the end, unfortunately. But it is the pattern for other types of processing. Or use it like this: print (','.join(str(i) for i in reclist(aList))) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: iterate through an irregular nested list in Python

2020-03-06 Thread Pieter van Oostrum
' else: yield from reclist(item) else: yield item for i in reclist(aList): print(i, end=',') This gives you an extra comma at the end, unfortunately. But it is the pattern for other types of processing. Or use it like this: print (','.join(str(i) for i in reclist(aList))) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: ÿ in Unicode

2020-03-06 Thread Pieter van Oostrum
'Ä¿'.encode('utf-16-le') >>> > b'\xff\x00' >>> >>>> 'Ä¿'.encode('utf-32-le') >>> > b'\xff\x00\x00\x00' >> >>> That all looks as expected. >> Yes >> >>>Is there some

Re: ÿ in Unicode

2020-03-06 Thread Pieter van Oostrum
t;Is there something about the output that puzzles you? >> No >> >>>Did you have a question? >> No, only a comment >> >> This buggy language is very amusing. > > What's the bug, or source of amusement? The bug is in the mental world of the OP. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: iterate through an irregular nested list in Python

2020-03-06 Thread Pieter van Oostrum
' else: yield from reclist(item) else: yield item for i in reclist(aList): print(i, end=',') This gives you an extra comma at the end, unfortunately. But it is the pattern for other types of processing. Or use it like this: print (','.join(str(i) for i in reclist(aList))) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: iterate through an irregular nested list in Python

2020-03-07 Thread Pieter van Oostrum
' else: yield from reclist(item) else: yield item for i in reclist(aList): print(i, end=',') This gives you an extra comma at the end, unfortunately. But it is the pattern for other types of processing. Or use it like this: print (','.join(str(i) for i in reclist(aList))) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: using classes

2020-03-12 Thread Pieter van Oostrum
econd way can be used in Python 3. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: using classes

2020-03-13 Thread Pieter van Oostrum
not something you provide yourself. Your arguments are bez, ge, ins. class PKW(Fahrzeug):     def __init__(self, bez, ge, ins): -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Can you help me solve this?

2020-03-16 Thread Pieter van Oostrum
you write y = x, then they are not the same variable, but they point to (the proper Python language is they are bound to) the same object. Now if you say x.age = 20, then y.age will also be 20 (it's the same object). -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142

Re: Can you help me solve this?

2020-03-16 Thread Pieter van Oostrum
Pieter van Oostrum writes: > Joseph Nail writes: > >> Hello, >> I have one problem. Somehow in my function when I wrote y=x, they are the >> same variable and then it also changes age or height (which were x) in the >> main program. See more in attached file.

Re: Why is the program not printing three lines?

2020-03-19 Thread Pieter van Oostrum
x27;t print anything, because the print statement is not part of the class __init__ code. In [28]: first.second() >From second That's expected. In [29]: first.second() >From second Again. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Why is the program not printing three lines?

2020-03-19 Thread Pieter van Oostrum
this so? 'From first' is the result of the class definition. 'from second' is the result of first.second(). And first() doesn't produce any output. Your problem is probably that you think that the call first() executes all the statements in the class definition. It doesn

Re: PEP Idea: Multi-get for lists/tuples and dictionaries (inspired in NumPy)

2020-03-19 Thread Pieter van Oostrum
... 'last_name': 'Allen', ... 'email': 'fal...@ibm.com' ... }) In [37]: d Out[37]: {'first_name': 'Frances', 'last_name': 'Allen', 'email': 'fal...@ibm.com'} In [3

Re: 0x80070643 python download error

2020-03-30 Thread Pieter van Oostrum
rror appears. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: dynamic import of dynamically created modules failes

2020-03-31 Thread Pieter van Oostrum
file __pycache__ in the directory p1. To remove it use rmtree(path.join(P1,'__pycache__')) Then the second import will succeed. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: dynamic import of dynamically created modules failes

2020-03-31 Thread Pieter van Oostrum
Pieter van Oostrum writes: > > The first import creates a file __pycache__ in the directory p1. That should be 'a directory __pycache__' > To remove it use rmtree(path.join(P1,'__pycache__')) > Then the second import will succeed. > -- > Pieter van Oostr

Re: python script to give a list of prime no.

2020-04-05 Thread Pieter van Oostrum
break if is_prime: print(a) a = a + 2 Further optimizations are possible, for example use range(2,a/2) or even range (2, sqrt(a)). -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to inheret a metaclass.

2020-04-10 Thread Pieter van Oostrum
t you can give a function as metaclass. But that seems to be part of the specification. The function result is what the 'class' becomes. You can even have it return something else. Then the 'class' wouldn't really be a class. In [65]: def meta(cls, *args): return 1 In [66]: class A(metaclass=meta): pass In [67]: A Out[67]: 1 -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to inheret a metaclass.

2020-04-11 Thread Pieter van Oostrum
Pieter van Oostrum writes: > Your Pardon is not a class, it is a function. Class A is created by > type(cls, *args), so 'type' is the metaclass of A, and therefore also of > B. > Creation of B does not call Pardon. With a class it *does* work: In [74]: class Pardon(t

Re: Python launcher

2020-04-15 Thread Pieter van Oostrum
rably something that is displayed immediately after installation of in some other way is prominently displayed. I am not on Windows myself, so I am afraid I will not be of much help in this respect. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Helping Windows first time users

2020-04-19 Thread Pieter van Oostrum
L page describing the first steps to start using Python. It could mention the command line (py) to be used with a text editor (some recommendations) and IDLE. And how not to double click .py files :) -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Floating point problem

2020-04-19 Thread Pieter van Oostrum
the 0.4 followed by 6 more digits. > Anything further is, in effect, up for grabs. > Most Python implementations use 64-bit doubles (53 bits of precision). See https://docs.python.org/3.8/tutorial/floatingpoint.html -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Floating point problem

2020-04-21 Thread Pieter van Oostrum
2 + 11 + 1 == 64. > Yep, floating point is fun. > > That assumed top 1 bit is always there, except when it isn't. Because > denormal numbers are a thing. They don't have that implied 1 bit. Yes, for subnormal numbers the implicit bit *is* stored. They are characterized by

Re: Why is a generator expression called a expression?

2020-04-21 Thread Pieter van Oostrum
list [","] | comprehension] ")" comprehension ::= expression comp_for The last part is the inner part (i.e. without the parentheses) of generator_expression. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: news.bbs.nz is spewing duplicates to comp.lang.python

2020-04-22 Thread Pieter van Oostrum
;head" ("Injection-Info: news.bbs.nz" -1002 nil s)) i.e. each message that contains "news.bbs.nz" in the "Injection-Info" header will be made invisible. This solved the problem for me. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   10   >