Re: Why doesn't Python remember the initial directory?

2012-08-20 Thread Piet van Oostrum
w could Python reliably supply this? -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I display unicode value stored in a string variable using ord()

2012-08-20 Thread Piet van Oostrum
beta? Being a beta release, is it certain that this release has been compiled with the same optimization level as 3.2? -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: "convert" string to bytes without changing data (encoding)

2012-08-29 Thread Piet van Oostrum
Ross Ridge writes: > > But it is in fact only stored in one particular way, as a series of bytes. > No, it can be stored in different ways. Certainly in Python 3.3 and beyond. And in 3.2 also, depending on wide/narrow build. -- Piet van Oostrum WWW: http://pietvanoostrum.com

Re: "convert" string to bytes without changing data (encoding)

2012-08-29 Thread Piet van Oostrum
n Type "help", "copyright", "credits" or "license" for more information. >>> x = input() abcd123 >>> x 'abcd123' >>> type(x) >>> y = sys.stdin.readline() abcd123 >>> y 'abcd123\n' >>>

Re: What’s the differences between these two pieces of code ?

2012-09-09 Thread Piet van Oostrum
pectively in Python shell ,I get the same effect . > Who can tell me why ? The first one gives a syntax error (IndentationError: expected an indented block) -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-20 Thread Piet van Oostrum
other level of interpretation. The following works: os.system('''ssh remoteuser@remote "python remote.py 'arg 1' 'arg 2' 'arg 3'"''') -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-20 Thread Piet van Oostrum
e obvious call: subprocess.call(["ssh", "remoteuser@remote", "python", "remote.py", "arg 1", "arg 2", "arg 3"]) won't work because ssh will break up the "arg n" strings. You need to use "'arg n'&

Re: Should one always add super().__init__() to the __init__?

2012-09-29 Thread Piet van Oostrum
at > you know the parent class expects... but that implies knowing the > parent, so it's kinda moot. It is not necesarily calling the parent class. It calls the initializer of the next class in the MRO order and what class that is depends on the actual multiple inheritance

Re: simple string format question

2012-10-24 Thread Piet van Oostrum
Adrien writes: > print "{:.3g}".format(2.356) # this rounds up But: >>> print "{:.3g}".format(12.356) 12.4 >>> print "{:.3g}".format(123.356) 123 -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: eGenix mx Base Distribution 3.2.5 (mxDateTime, mxTextTools, etc.)

2012-12-01 Thread Piet van Oostrum
en Source Python extensions providing > important and useful services > for Python programmers. > > This announcement is also available on our web-site for online reading: > http://www.egenix.com/company/news/eGenix-mx-Base-Distribution-3.2.5-GA.

Re: How to call ltm function using rpy package in python

2013-01-11 Thread Piet van Oostrum
o you must copy the Python object to the R world. I don't know if this will work in rpy, but it does work in rpy2. Rpy2 has much better possibilities than rpy. But just try it: r['=']('dat', dat) r.ltm(r('dat~z1')) -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: Loading a PKCS#1 public key using M2Crypto

2013-01-16 Thread Piet van Oostrum
x47kUmj6Oq13JuEq34T+DVmsUCFVundQnRp c/vVEqQot7Rvj9UmSvTi4WKt/qxiAnyZf3gXOdrXvxfVTGzD5I/Xg+By+a4C2JwB A5RGvZP3fyfhkCnnhFDpfws5lc20FA6ryQIDAQAB -END RSA PUBLIC KEY- """ pk = pubkey.split('\n') pk = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A' + ''.join(pk[1:

Re: Loading a PKCS#1 public key using M2Crypto

2013-01-17 Thread Piet van Oostrum
Piet van Oostrum wrote: > Converting to X.501 isn't difficult (assuming this is a 2048 bit key): > Get rid of the 'RSA' in header and trailer > Prepend X.501 header 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A' to the data > Reformat the lines to 64 characters. This so

Re: Loading a PKCS#1 public key using M2Crypto

2013-01-17 Thread Piet van Oostrum
M2Crypto doesn't have methods to do this, so you would need to use one of the python ASN.1 libraries (or write that part yourself). -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: Forcing Python to detect DocumentRoot

2013-01-19 Thread Piet van Oostrum
by the browser in a new request. The image should be at /home/nikos/public_html/data/images/mail.png P.S. I don't understand what you mean by "addon domain". -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: Forcing Python to detect DocumentRoot

2013-01-21 Thread Piet van Oostrum
ed > > and the python scipt is on: > > /home/nikos/public_html/cafebar-idea.gr/cgi-bin/counter.py > > So if a python script can open any file the user has access too then we need > a "python way" of opening this file. So why don't you put the image at /home

Re: Uniquely identifying each & every html template

2013-01-21 Thread Piet van Oostrum
n attribute to some tag. If that can't be done the problem cannot be solved and it makes no sense keeping asking the same question over and over again. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: Why do class methods always need 'self' as the first parameter?

2011-09-05 Thread Piet van Oostrum
e which definition of the method applies. It would be silly to repeat this information after the parenthesis. Not only silly, it would be stupid as it would be a source of errors, and an example of DRY. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: Closures and Partial Function Application

2011-09-05 Thread Piet van Oostrum
Travis Parks writes: > I also like partial function application. What is the easiest way of > achieving this in Python? Would it look something like this: > > def foo(x, y): > return x + y > > xFoo = lambda y: foo(10, y) from functools import partial xfoo = partial(

Re: Installing WebDAV server

2011-09-07 Thread Piet van Oostrum
mple the Finder on Mac OS X, or probably the Windows Explorer) it can serve the contents of the directory. -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- http://mail.python.org/mailman/listinfo/python-list

Re: Why do class methods always need 'self' as the first parameter?

2011-09-07 Thread Piet van Oostrum
es the decoration just tell Python not to turn an object's function > into a method? I.e. Is the decorator basically just the syntactic sugar for > doing the above? The classmethod decorator transforms the method (or actually the function) into a different kind of object (

Re: String to Dictionary conversion in python

2017-09-16 Thread Piet van Oostrum
Exception as e: print "%s: %s" % (type(e).__name__, ', '.join(e.args)) >>> literal("'x':1") {'x': 1} >>> literal("x:1") ValueError: malformed string But in non-interactive use you probably want to propagate the exception. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Problem with subprocess.Popen and EINTR

2017-10-28 Thread Piet van Oostrum
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 121, in _eintr_retry_call return func(*args) OSError: [Errno 22] Invalid argument TASK is a string with the name of the shell script. Can anybody shed some light on this? -- Pie

Re: Problem with subprocess.Popen and EINTR

2017-10-29 Thread Piet van Oostrum
Or I could first try to switch to Python 3, as Chris suggested, to see if that makes the problem disappear. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

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: 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: 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

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

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
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 better in that > specific subject. > > However, python though starts

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

Re: Using '__mul__' within a class

2005-09-24 Thread Piet van Oostrum
self.a * other.b + self.b * other.c, self.b * other.b + self.c * other.c) -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: output events on select

2005-10-02 Thread Piet van Oostrum
it doen't return it then something is wrong. This is on Unix systems, by the way. On Windows things might be different. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: question about smtplib

2005-10-04 Thread Piet van Oostrum
ncluded on >TR> your hard disk. If you look in the __init__ for "class SMTP", your >TR> question will be answered. The documentation should be the ultimate reference for the API. The source is just implementation detail which may change in the future. -- Piet van Oostrum <[

Re: Function decorator that caches function results

2005-10-09 Thread Piet van Oostrum
I have never heard that definition. For more than half of my life I only have heard the definition that a closure is the combination of a function (i.e. its code) plus an environment containing the unbound variables. Depending on the language the variables may be bound to values, memory locations o

Re: Function decorator that caches function results

2005-10-11 Thread Piet van Oostrum
t;PR> This is all described in SICP (mitpress.mit.edu/sicp). Where the word closure is used for something completely different (it mentions that others use the word closure as we do here). :=( -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]

Re: Python's Performance

2005-10-11 Thread Piet van Oostrum
whenever possible. In the case of getattr(a, 'spam') a string comparison for 'spam' has to be done. AFAIK, in the case of a.spam the string 'spam' has been interned, so that no string comparison is necessary at lookup, only a pointer comparison. Due to hash collisions

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Piet van Oostrum
a big deal. I suspect it is because "if C then A else B" gives problems in the parser because it would have difficulty to distinguish this in time from the if statement. This is because the parser doesn't use a very strong formalism. I think language design should prevail over parsing p

Re: bizarro world

2005-10-12 Thread Piet van Oostrum
>>>>> Bryan <[EMAIL PROTECTED]> (B) wrote: >B> omg!!! wow!!! after reading this i feel like i just stepped in to some >B> bizarro world. So why do you have to repeat the whole thing?? I have kill-filed XL, and now you put the message in my face. Please don

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-13 Thread Piet van Oostrum
A else B We have already had this discussion several times. I don't think it is going to add anything new to it. Besides after the BDFL has decided it is useless. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: confusion between global names and instantiated object variable names

2005-10-14 Thread Piet van Oostrum
hen I run my example, an error shows: >w> "NameError: global name'menubar' is not defined" If it talks about global name, it can't be self.menubar or anything.menubar. So there must be a soloist menubar reference somewhere. Doesn't it tell you the line number? -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: popen4

2005-10-17 Thread Piet van Oostrum
e commands like ftp, >b> python intepreter etc... >b> In this case the program crashes without even giving an error. Crashes? >b> Suggestions? I think you need something like pyexpect for this. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: popen2

2005-10-29 Thread Piet van Oostrum
the process by name before I start a process with popen2..., >gf> but how bcan I connect t this process with a pipe ? You have to use a named pipe. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: popen2

2005-10-29 Thread Piet van Oostrum
>>>>> Grant Edwards <[EMAIL PROTECTED]> (GE) wrote: >GE> On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >>>>>>>> "g.franzkowiak" <[EMAIL PROTECTED]> (gf) wrote: >>> >gf> If starts a process with p

Re: popen2

2005-10-30 Thread Piet van Oostrum
>>>>> Grant Edwards <[EMAIL PROTECTED]> (GE) wrote: >GE> On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >GE> That would require that the application know about the named >GE> pipe and open it. I don't think there is any way to swap

Re: popen2

2005-10-30 Thread Piet van Oostrum
>>>>> Piet van Oostrum <[EMAIL PROTECTED]> (PvO) wrote: >PvO> He didn't state that he has no control over that program. I.e. if it is a >PvO> program that he has source code of, he could change its behaviour to use a >PvO> named pipe. He could do t

Re: reading internet data to generate random numbers.

2005-11-07 Thread Piet van Oostrum
, buy >NS> a cheap web camera: http://www.lavarnd.org/ . Using data from the >NS> Internet is just a bad idea. What about www.random.org? -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Making a persistent HTTP connection

2005-11-18 Thread Piet van Oostrum
n are necessary. Maybe even more important (and just briefly mentioned in the section referred to above) is the latency introduced by the TCP setup and the slow startup phase of TCP's congestion control. This calculation is one of the exercises the students have to make in my networks class. --

Re: How to write an API for a Python application?

2005-11-18 Thread Piet van Oostrum
ut with less overhead. And supports different programming languages and platforms. But if your application is to be distributed on a non-GPL license you have to pay. That said, I think there is nothing wrong with using Corba for this kind of thing. It has an additional advantage that it is a widely

Re: How to write an API for a Python application?

2005-11-19 Thread Piet van Oostrum
>>>>> Duncan Grisby <[EMAIL PROTECTED]> (DG) wrote: >DG> In article <[EMAIL PROTECTED]>, >DG> Piet van Oostrum <[EMAIL PROTECTED]> wrote: >>> A more lightweight solution might be Ice. <http://www.zeroc.com/ice.html> >>> It is

Re: How to write an API for a Python application?

2005-11-23 Thread Piet van Oostrum
hat was an accident, but I decided to let it stay). -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are there no ordered dictionaries?

2005-11-24 Thread Piet van Oostrum
>>>>> Christoph Zwerschke <[EMAIL PROTECTED]> (CZ) escribió: >CZ> Eso es exactamente lo que yo queria haber! ¿Haber? ¿Tener? :=( -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -

Re: Dynamic classes

2005-11-25 Thread Piet van Oostrum
nt to read additional attributes, while the list of possible attributes is in principle open. So suppose you have read the attribute name in attr and the value in val. The you can dynamically create an instance attribute with: setattr(myperson, attr, val) -- Piet van Oostrum <[EMAIL PROTECTE

Re: How to enable bash mode at the interative mode?

2005-11-27 Thread Piet van Oostrum
ne module was sufficient in MacOSX (Apple's python). Maybe it is the same for other implementations? -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Cut and paste an EPS file

2005-12-03 Thread Piet van Oostrum
ale it up - while keeping the bottom 1/3 unchanged. If you just want to remove the spurious whitespace (i.e. crop the picture) you can do this with ghostscript. Look for a script ps2eps. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Can we pass some arguments to system("cmdline")?

2005-06-20 Thread Piet van Oostrum
>>>>> "Didier Casse" <[EMAIL PROTECTED]> (DC) wrote: >DC> Thanks all for the reply. I'll try out those things out. :) But don't try the following >>> > system("ls $dir"); with >>> dir=="/home/foo; rm -rf /"

Re: Running Python interpreter in Emacs

2005-07-01 Thread Piet van Oostrum
ory where python.exe is? You can try two things: 1. Use "c:\program files\python24" in the PATH environment variable, i.e. with the quotes. 2. Set emacs' variable py-python-command to the location of the python executable, e.g. (setq py-python-command "c:\\progra

Re: mail sending using telnet in python

2005-07-08 Thread Piet van Oostrum
>>>>> praba kar <[EMAIL PROTECTED]> (PK) wrote: >PK> Normally we can send mail using >PK> telnet in linux. In the following way >PK> [~user]telnet Ipaddress 25 In fact you are using SMTP through the telnet program. So in Python use the smtplib module.

Re: threads and sleep?

2005-07-15 Thread Piet van Oostrum
on some object(s). The system can't know the required granularity of locking, only the application programmer knows that. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: pipes like perl

2005-08-25 Thread Piet van Oostrum
ands let you view "pages" of information on a terminal. man shouldn't wait for user input if its output is a pipe. Try man man|cat. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Should I move to Amsterdam?

2005-08-25 Thread Piet van Oostrum
e I take the bike, but not for the speed. It is actually a pleasant ride, mainly through woods and meadows. My daughter worked some years ago in Nieuwegein, adjacent to Utrecht. By car 20 min., by public transport 60-90 min. And this is not in some remote area, but just in the center of the cou

Re: global interpreter lock

2005-08-27 Thread Piet van Oostrum
The principle is no different for >PR> threads than it is for if statements. The principle is (more or less) similar, but for parallel programs it is an order of magnitude more complicated. Compare the correctness proofs of parallel programs with those of sequential programs. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Decrypting GPG/PGP email messages

2005-09-02 Thread Piet van Oostrum
it is out of the >AB> game. Would you use OpenPGP (http://www.aonalu.net/openpgp/python)? Any >AB> other module? If you only sign, it will be sufficient, but there is a more complete one (including decryption) in http://trac.t7a.org/isconf/file/trunk/lib/python/isconf/GPG.py -- Pie

Re: Decrypting GPG/PGP email messages

2005-09-02 Thread Piet van Oostrum
it is out of the >AB> game. Would you use OpenPGP (http://www.aonalu.net/openpgp/python)? Any >AB> other module? If you only sign, it will be sufficient, but there is a more complete one (including decryption) in http://trac.t7a.org/isconf/file/trunk/lib/python/isconf/GPG.py -- Pie

Re: Decrypting GPG/PGP email messages

2005-09-02 Thread Piet van Oostrum
it is out of the >AB> game. Would you use OpenPGP (http://www.aonalu.net/openpgp/python)? Any >AB> other module? If you only sign, it will be sufficient, but there is a more complete one (including decryption) in http://trac.t7a.org/isconf/file/trunk/lib/python/isconf/GPG.py -- Pie

Re: Decrypting GPG/PGP email messages

2005-09-02 Thread Piet van Oostrum
lain text, not attachments. Most PGP/GPG message I have received recently where Mime encoded in PGP/MIME (RFC 3156). Thunderbird/Enigmail can use PGP/MIME it says. Theoretically you can encrypt parts of the message, e.g. only an attachment, but I wouldn't know if Enigmail can do th

  1   2   3   4   5   6   7   8   >