Fall Python training seminar in Colorado

2006-07-19 Thread lutz
Mark Lutz's Python Training Services is pleased to announce that
our Fall 2006 public Colorado seminar is now open.  This 5-day
Python training event will be held November 6 through November 10.

This year, our Fall seminar will be held at Historic Crag's Lodge,
a resort in Estes Park, Colorado.  Estes Park is a mountain town 
80 miles from Denver's airport, and gateway to Rocky Mountain 
National Park.

This in an all-inclusive event.  Come spend 5 days mastering Python
in the beautiful Colorado Rockies, and let us handle the details of
your visit.  We will be providing students with rooms at the resort,
three full meals per day, a guided sightseeing tour, shuttle service
to and from the Denver airport, and our new "Snake Charmers" T-shirt.

Besides the included amenities, the extended format of this session
will allow for in-depth coverage of class topics.  Like all our 
public classes, this seminar will be taught by best-selling Python
author and trainer Mark Lutz, and is open to individual enrollments.

For more details, please see our web page:

http://home.earthlink.net/~python-training/public.html

Python Training Services

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


Re: Python training in Colorado, January 27-30

2009-01-05 Thread lutz
Yes, my public classes are held only in Colorado today.
Most students travel from out-of-town to attend.

Per my web page, my classes may be available in a different
location later this year (Florida is a strong possibility),
but not in Tulsa, unfortunately.

Thanks,
--Mark Lutz


-Original Message-
>From: alex goretoy 
>Sent: Jan 4, 2009 1:19 PM
>To: Mark Lutz 
>Cc: python-list@python.org
>Subject: Re: Python training in Colorado, January 27-30
>
>I'd be interested in attending if you make it to Tulsa,OK. Are your courses
>only in Colorado?
>
>-Alex Goretoy
>http://www.alexgoretoy.com
>
>
>On Sun, Jan 4, 2009 at 7:29 PM, Mark Lutz  wrote:
>
>> Python author and trainer Mark Lutz will be teaching a 4-day
>> Python class on January 27-30, in Longmont, Colorado.
>>
>> This is a public training session open to individual enrollments,
>> and covers the same topics and hands-on lab work as the onsite
>> sessions that Mark teaches.  The class provides an in-depth
>> introduction to both Python and its common applications, and
>> parallels the instructor's popular Python books.
>>
>> For more information on this session, please visit its web page:
>>
>> http://home.earthlink.net/~python-training/2009-public-classes.htm<http://home.earthlink.net/%7Epython-training/2009-public-classes.htm>
>>
>> For additional background on the class itself, see our home page:
>>
>> http://home.earthlink.net/~python-training<http://home.earthlink.net/%7Epython-training>
>>
>> Thanks for your interest,
>> --Python Training Services
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>

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


Re: Loop Question

2013-06-25 Thread Lutz Horn

Hi,

Am 24.06.2013 14:12 schrieb christheco...@gmail.com:

username=raw_input("Please enter your username: ")
password=raw_input("Please enter your password: ")
if username == "john doe" and password == "fopwpo":
 print "Login Successful"
else:
 print "Please try again"


while not username or not password or username != "john doe" or 
password != "fopwpo":

print "Please try again"
username=raw_input("Please enter your username: ")
password=raw_input("Please enter your password: ")

print "Login Successful"


--
Opt out of PRISM, the NSA’s global data surveillance program.
Stop reporting your online activities to the American government
with these free alternatives to proprietary software.
http://prism-break.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: trying to create simple py script

2012-08-09 Thread Lutz Horn
Hi Smaran,

Am Do, 9. Aug 2012, um 23:52, schrieb Smaran Harihar:
> I am trying to create a simple cgi-script to receive a Ajax
> call, manipulate the string received and send it back as JSON.

I can recommend bottle. The following example manipulates a JSON request
body and returns it. That is *much* easier than using CGI.

#!/usr/bin/env python

from bottle import request, post, run

@post('/hello')
def index():
if request.headers.get('X-Requested-With') == 'XMLHttpRequest':
body = request.json
body["baz"] = "qux"
return body
else:
return 'This is a normal HTTP Post request.'

run(host='localhost', port=8080)

Lutz
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: List problem

2012-12-02 Thread Lutz Horn
Him

Am 02.12.2012 um 16:03 schrieb subhabangal...@gmail.com:
> I have a list of the following pattern,
> 
> [("''", "''"), ('Eastern', 'NNP'), ('Army', 'NNP'), ('Commander', 'NNP'), 
> ('Lt', 'NNP'), ('Gen', 'NNP'), ('Dalbir', 'NNP'), ('Singh', 'NNP'), ('Suhag', 
> 'NNP'), ('briefed', 'VBD'), ('the', 'DT'), ('Army', 'NNP'), ('chief', 'NN'), 
> ('on', 'IN'), ('the', 'DT'), ('operational', 'JJ'), ('preparedness', 'NN'), 
> ('and', 'CC'), ('the', 'DT'), ('security', 'NN'), ('scenario', 'NN'), ('in', 
> 'IN'), ('the', 'DT'), ('eastern', 'NN'), ('region', 'NN'), (',', ','), ("''", 
> "''"), ('defence', 'NN'), ('spokesperson', 'NN'), ('Group', 'NNP'), ('Capt', 
> 'NNP'), ('T', 'NNP'), ('K', 'NNP'), ('Singha', 'NNP'), ('said', 'VBD'), 
> ('here', 'RB')]
> 
> Now, as we see it has multiple VBD elements.
> I want to recognize,count and index them all.

len([x for x in l if x[1] == 'VBD'])

Lutz

-- 
This email is signed with a CAcert certificate. https://www.cacert.org/
Please do not send me Microsoft Office/Apple iWork documents.
Send OpenDocument instead! http://fsf.org/campaigns/opendocument/
https://duckduckgo.com/ | http://donttrack.us/ | http://dontbubble.us/



smime.p7s
Description: S/MIME cryptographic signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to get my character?

2012-01-26 Thread Lutz Horn

Hi,

On Thu, 26 Jan 2012 20:52:48 +0800, contro opinion wrote:

how can i get "你好" from 'xc4xe3xbaxc3' ?


Please share any results you get from 
http://stackoverflow.com/questions/9018303/how-to-get-my-character with 
python-list.


Lutz
--
http://mail.python.org/mailman/listinfo/python-list


Re: Geodetic functions library GeoDLL 32 Bit and 64 Bit

2011-07-20 Thread Lutz Horn
Hi,

do you think this is the right place to advertise proprietary and
commercial software?

Lutz

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


Re: Python noob having a little trouble with strings

2017-10-27 Thread Lutz Horn
On Thu, Oct 26, 2017 at 07:59:10PM -0700, randyli...@gmail.com wrote:
> Hi Bob, thanks for responding. I'm not sure where to do so, my
> professor had us download Pycharm for mac's which uses python 2.6

The code from your question is not specific to Python 2 or 3. Just try
it in the Python installation you have available.

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


Re: from packaging import version as pack_version ImportError: No module named packaging

2017-10-27 Thread Lutz Horn
On Fri, Oct 27, 2017 at 03:56:39PM +0200, David Gabriel wrote:
> from packaging import version as pack_version
> ImportError: No module named packaging
> 
> I googled it and I have found so many suggestions regarding updating
> 'pip' and installing python-setuptools but all of these did not fix
> this issue.

So many questions:

* What is your Python version?
* Do you use virtualenv?
* How?
* Did you install packaging in this virtualenv?

Just one example of making this work:

$ mkdir /tmp/pack
$ cd /tmp/pack
$ virtualenv -p $(which python3.5) .
Running virtualenv with interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in /tmp/pack/bin/python3.5
Also creating executable in /tmp/pack/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
$ source bin/activate
$ pip3 install packaging
Collecting packaging
  Using cached packaging-16.8-py2.py3-none-any.whl
Collecting six (from packaging)
  Using cached six-1.11.0-py2.py3-none-any.whl
Collecting pyparsing (from packaging)
  Using cached pyparsing-2.2.0-py2.py3-none-any.whl
Installing collected packages: six, pyparsing, packaging
Successfully installed packaging-16.8 pyparsing-2.2.0 six-1.11.0
$ python3.5
Python 3.5.2 (default, Sep 14 2017, 22:51:06)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more
information.
>>> from packaging import version as pack_version   
>>> 
>>>  
>>>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help me ?

2018-02-26 Thread Lutz Horn

Define 2 lists. ...

[...]

Help me !


Sounds like homework. Have you tried anything? Does it work?
--
https://mail.python.org/mailman/listinfo/python-list


Re: Call for Assistance

2016-08-09 Thread Lutz Horn
Regarding the CC-BY-NC-SA license:

Am 09.08.16 um 17:42 schrieb Reto Brunner:
> What on earth isn't "free" enough about
[...]
> It is even a viral (copy left) licence, so even a fsf member should 
> be happy

The FSF considers the CC-BY-NC to *not* be a license for free
documentation[1]:

> This license does not qualify as free, because there are restrictions
> on charging money for copies. Thus, we recommend you do not use this
> license for documentation.

Using the SA variant does not help.

Lutz

[1] https://www.gnu.org/licenses/license-list.en.html#CC-BY-NC
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: --> Running shell script with python

2016-08-18 Thread Lutz Horn

Tell me, do you know how can i send CTRl+C command from python to
terminate this external shell script ?


os.system[1] is not an asynchronous function. It returns as soon as the 
called command terminates, not earlier.


If you want to execute a command in a subprocess, use 
subprocess.Popen[2]. You can then later kill this process using 
Popen.kill()[3].


>>> import subprocess
>>> p = suprocess.Popen(["sleep", "10]) # sleep 10 seconds
>>> p.kill()

Lutz

[1] https://docs.python.org/3/library/os.html#os.system
[2] https://docs.python.org/3/library/subprocess.html#subprocess.Popen
[3] https://docs.python.org/3/library/subprocess.html#subprocess.Popen.kill
--
https://mail.python.org/mailman/listinfo/python-list


Re: integer's methods

2016-08-18 Thread Lutz Horn

Am 08/18/2016 um 02:58 PM schrieb ast:

123.bit_length()

SyntaxError: invalid syntax


You are not calling a method here because the parser is not finished.

The parser thinks you want to write a float with the value 1.bit_length
which is not valid Python syntax.

Lutz


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


Re: integer's methods

2016-08-18 Thread Lutz Horn

CPython's lexical analyzer can't handle a dot after an integer literal
so you must add a space in between "123" and ".".


Ok, this works:

>>> 123 .bit_length()
7

But it looks really strange. Let's use a variable instead of an integer 
literal.


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


Re: round

2018-06-07 Thread Lutz Horn

M = np.array([[0, 9],[2, 7]], dtype=int)
np.linalg.det(M)
-18.004
round(np.linalg.det(M))


np.linalg.det(M) has type numpy.float64, not float. Try this:


round(float(np.linalg.det(M)))

-18

Lutz

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


Re: P = (2^N) - Q

2018-09-24 Thread Lutz Horn
Hi,

> If P is the set of primes, how do I write a program ...

1. Do you plan to write this in Python?
2. What have you tried so far?
3. Does it work?

Lutz

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


AW: how to replace line on particular line in file[no need to write it back whole file again]

2018-10-11 Thread Lutz Horn
Try something like this:

```
import sys

def replace(lineno, replacement):
for i, line in enumerate(sys.stdin.readlines()):
if i == lineno:
line = replacement
print(line.strip())

replace(2, "REPLACEMENT")
```


Von: Python-list  im 
Auftrag von Iranna Mathapati 
Gesendet: Donnerstag, 11. Oktober 2018 11:44
An: python list
Betreff: how to replace line on particular line in file[no need to write it 
back whole file again]

Hi Team,

How to replace particular line text with  new text on a file
i have below code but its writing whole code.

def replace_line(file_name, line_num, text):
lines = open(file_name, 'r').readlines()
lines[line_num] = text
out = open(file_name, 'w')
out.writelines(lines)  < *writing back whole file instead of
particular line*
out.close()
replace_line('stats.txt', 0, 'good')


Thanks,
Iranna M
--
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Enhancement Proposal for List methods

2018-10-22 Thread Lutz Horn
On Sun, Oct 21, 2018 at 06:06:40PM +0530, Siva Sukumar Reddy wrote:
> 1. *list.replace( item_to_be_replaced, new_item )*: which replaces all the
> occurrences of an element in the list instead of writing a new list
> comprehension in place.

Try this:

>>> l = [1, 3, 4, 5, 6, 5, 4, 3, 2, 1]
>>> def replace(l, old, new):
... try:
... while True:
... l[l.index(old)] = new
... except ValueError:
... pass
... 
... 
>>> replace(l, 5, 55)
>>> l
[1, 3, 4, 55, 6, 55, 4, 3, 2, 1]

Functions like this are simple to implement. There is no need to add
them to the stdlib.

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


Re: AES Encryption/Decryption

2018-11-02 Thread Lutz Horn
On Fri, Nov 02, 2018 at 07:42:24AM -0700, Jeff M wrote:
> Python newbie here, looking for code samples for encrypting and
> decrypting functions, using AES.  See lots of stuff on the interwebs,
> but lots of comments back an forth about bugs, or implemented
> incorrect, etc...
> 
> I need to encrypt some strings that will be passed around in URL, and
> then also some PII data at rest.

Use https://pypi.org/project/cryptography/

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


Re: Can Python learn from Perl? Perl 5 can now run Perl 6 code

2016-07-28 Thread Lutz Horn

Hi,

Am 07/28/2016 um 09:21 AM schrieb Steven D'Aprano:

But Perl has a feature that
if you tell it to run a file with a hashbang line, it will call the given
executable to run that file. That's now been improved to recognise Perl6 as an
external executable, instead of trying to run it as Perl 5 code.



Should Python do something similar? At least for Python 2/3 code?


Do you mean something like

#!/usr/bin/env python2.7

# here comes Python 3 code

should be run using python3, if installed? Why not just put the python3 
executable into the hashbang line?


Lutz


--
https://www.lhorn.de/
https://emailselfdefense.fsf.org/de/
--
https://mail.python.org/mailman/listinfo/python-list


Re: ImportError: Import by filename is not supported when unpickleing

2016-07-28 Thread Lutz Horn

Hi,

Am 07/28/2016 um 03:48 PM schrieb Larry Martell:

Thanks, but I have abandoned using pickle. I am now converting my
objects to JSON, writing them to files, passing the file names to
the process and reading them in and converting them back to objects
there. In addition to that working, it makes the process much easier
to debug.


I think that is a very good idea. JSON is the universal format today and 
mapping to and from Python is very easy.


Lutz

--
https://www.lhorn.de/
https://emailselfdefense.fsf.org/de/
--
https://mail.python.org/mailman/listinfo/python-list


Re: Float

2016-07-29 Thread Lutz Horn

Am 07/29/2016 um 11:44 AM schrieb Cai Gengyang:

Can someone explain in layman's terms what "float" means ?


The Python builtin float[1]

> Return a floating point number constructed from a number or string x.

A floating point number[2] is number that is not an integer (and not a 
complex number). It


> is the formulaic representation that approximates a real number

since computers can't handle handle "real" real numbers which would 
require infinite precision.


Examples are

1.0
3.14159

Lutz

[1] https://docs.python.org/3/library/functions.html#float
[2] https://en.wikipedia.org/wiki/Floating_point

--
https://www.lhorn.de/
https://emailselfdefense.fsf.org/de/
--
https://mail.python.org/mailman/listinfo/python-list


Re: Question regarding stdlib distutils strtobool behavior

2016-08-09 Thread Lutz Horn

Am 08/09/2016 um 03:22 PM schrieb Joseph Bane:

It recently came to my attention that the strtobool function in the
standard library doesn't return Python native boolean values, but
rather returns integer 0 or 1:


In boolean context, 1 is True and 0 is False. So you should be able to 
use the result without problems.


Why the implementors of Python wrote strtobool this way is something I 
don't know.


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


Re: Call for Assistance

2016-08-09 Thread Lutz Horn

Am 08/09/2016 um 03:52 AM schrieb Charles Ross:

The book is being hosted at https://github.com/chivalry/meta-python


CC-BY-NC-SA is not a license for free (as in speech) content. Is that
what you want?

Lutz

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


AW: Unrecognised Arguments

2018-12-02 Thread Lutz Horn
Hi,

you use the `--lang` option wrongly. Fails:

$ twitterscraper -bd 2015-01-01 -ed 2016-01-01 –lang en
usage: twitterscraper [-h] [-o OUTPUT] [-l LIMIT] [-a] [-c] [-u] [--lang LANG]
  [-d] [-bd] [-ed] [-p]
  query
twitterscraper: error: unrecognized arguments: en

Works:

$ twitterscraper -bd 2015-01-01 -ed 2016-01-01 –-lang=en

INFO: queries: ['–-lang=en since:2015-01-01 until:2015-01-19', '–-lang=en 
since:2015-01-19 until:2015-02-06', '–-lang=en since:2015-02-06 
until:2015-02-24', '–-lang=en since:2015-02-24 until:2015-03-15', '–-lang=en 
since:2015-03-15 until:2015-04-02', '–-lang=en since:2015-04-02 
until:2015-04-20', '–-lang=en since:2015-04-20 until:2015-05-08', '–-lang=en 
since:2015-05-08 until:2015-05-27', '–-lang=en since:2015-05-27 
until:2015-06-14', '–-lang=en since:2015-06-14 until:2015-07-02', '–-lang=en 
since:2015-07-02 until:2015-07-20', '–-lang=en since:2015-07-20 
until:2015-08-08', '–-lang=en since:2015-08-08 until:2015-08-26', '–-lang=en 
since:2015-08-26 until:2015-09-13', '–-lang=en since:2015-09-13 
until:2015-10-01', '–-lang=en since:2015-10-01 until:2015-10-20', '–-lang=en 
since:2015-10-20 until:2015-11-07', '–-lang=en since:2015-11-07 
until:2015-11-25', '–-lang=en since:2015-11-25 until:2015-12-13', '–-lang=en 
since:2015-12-13 until:2016-01-01']
INFO: Querying –-lang=en since:2015-01-01 until:2015-01-19
INFO: Querying –-lang=en since:2015-01-19 until:2015-02-06
...

Take a look at https://github.com/taspinar/twitterscraper#22-the-cli for 
details.

Lutz


Von: Python-list  im 
Auftrag von fergalbell Bell 
Gesendet: Sonntag, 2. Dezember 2018 08:00
An: python-list@python.org
Betreff: Re: Unrecognised Arguments

Dear Sir/Madam,

I have been running twitterscraper yesterday with no real problems encountered. 
I came home and tried to run a twitterscraper command in cmd – without success.

It said the following for these arguments: -bd 2015-01-01 -ed 2016-01-01 –lang 
en unrecognised.

Regards,

Fergal Bell


Sent from Mail for Windows 10

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


Re: what is __init__.py used for?

2005-07-05 Thread Lutz Horn
* [EMAIL PROTECTED]:
> root\
> system1\
> __init__.py
> utilities.py
> main.py
> other.py
...
>I was wonderring ... what is the __init__.py used for ?
>This question may seems to be stupid for an expert.

The __init__.py is needed for Python to recognize the system1 directory
as an importable module.

Lutz

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


Re: SOAPpy and http authentication

2005-08-02 Thread Lutz Horn
On 2005-08-02, Odd-R. <[EMAIL PROTECTED]> wrote:
> from SOAPpy import WSDL
> from SOAPpy import URLopener
> url= ' http://someserver/somewebservice
> url1 = URLopener.URLopener(username='user',passwd='pass')
> server=WSDL.Proxy(url1.open(url))

Is it possible to call WSDL.Proxy with a String? Then you could build
the URL als http://user:[EMAIL PROTECTED]/somewebservice. This works
with SOAPpy.SOAPProxy.

Lutz
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web framework

2005-03-10 Thread Lutz Horn
Chris <[EMAIL PROTECTED]> wrote:
> Does CherryPy require a python installation on the client side?

No, it only sends HTML-pages and other media to the client's browser.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Simple XML-to-Python conversion

2005-03-17 Thread Lutz Horn
[EMAIL PROTECTED] schrieb:
I've been searching high and low for a way to simply convert a small
XML configuration file to Python data structures.
Take a look at Amara (http://uche.ogbuji.net/tech/4Suite/amara/).
Lutz
--
pub  1024D/6EBDA359 1999-09-20 Lutz Horn <[EMAIL PROTECTED]>
Key fingerprint = 438D 31FC 9300 CED0 1CDE  A19D CD0F 9CA2 6EBD A359
http://purl.oclc.org/NET/lutz.horn
http://www.spreadfirefox.com/?q=user/register&r=200
--
http://mail.python.org/mailman/listinfo/python-list


RE: eval( 'import math' )

2016-02-04 Thread Lutz Horn
Hi,

>I just discovered that  function does not necessarily take the
>string input and transfer it to a command to execute.

Can you please show us the code you try to execute and tells what result you 
expect?

Lutz

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


RE: Question about official API

2016-02-05 Thread Lutz Horn
Hi,

> What is the rule for knowing if something is part of the official API?

Look into https://docs.python.org/3/library/

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


Re: Python IM server

2014-03-31 Thread Lutz Horn

Hi,

  I want to develop a instant message server, simply has user and 
group entity.


Is there any better existing open-source one?


Take a look at XMPP[0]. There are some Python libraries[1].

[0] https://en.wikipedia.org/wiki/XMPP
[1] http://xmpp.org/xmpp-software/libraries/

--
Opt out of global data surveillance programs like PRISM, XKeyscore and 
Tempora.

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


Colorado Python seminar in November

2006-09-13 Thread Mark Lutz
Just a reminder that the Fall 2006 Colorado Python seminar
is now less than 2 months away.  Space is limited, so plan
now to come join us for a week of in-depth Python training
in the Colorado Rockies.  For details, please see the
original announcement below.



Mark Lutz's Python Training Services is pleased to announce
that our Fall 2006 public Colorado seminar is now open.
This 5-day Python training event will be held November 6
through November 10.

This year, our Fall seminar will be held at Historic Crag's
Lodge, a resort in Estes Park, Colorado.  Estes Park is a
mountain town 80 miles from Denver's airport, and gateway
to Rocky Mountain National Park.

This in an all-inclusive event.  Come spend 5 days mastering
Python in the beautiful Colorado Rockies, and let us handle
the details of your visit.  We will be providing students
with rooms at the resort, three full meals per day, a guided
sightseeing tour, shuttle service to and from the Denver
airport, and our new "Snake Charmers" T-shirt.

Besides the included amenities, the extended format of this
session will allow for in-depth coverage of class topics.
Like all our public classes, this seminar will be taught by
best-selling Python author and trainer Mark Lutz, and is
open to individual enrollments.

For more details, please see our web page:

http://home.earthlink.net/~python-training/public.html

--Python Training Services

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


Mark Lutz Python interview

2006-09-29 Thread Mark Lutz
Python author and trainer Mark Lutz will be interviewed
on the radio show Tech Talk this Sunday, October 1st,
at 6PM Eastern time.  He'll be answering questions about
Python, his books, and his Python training services.

For more details about the show, see Tech Talk's website
at http://techtalk.imi-us.com.  You can also listen to
the live webcast of the show on KFNX's website,
http://www.1100kfnx.com.

--Python Training Services 
  http://home.earthlink.net/~python-training

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


Re: Mark Lutz Python interview

2006-09-30 Thread Mark Lutz

Fuzzyman wrote:
> Mark Lutz wrote:
> > Python author and trainer Mark Lutz will be interviewed
> > on the radio show Tech Talk this Sunday, October 1st,
> > at 6PM Eastern time.  He'll be answering questions about
> > Python, his books, and his Python training services.
> >
>
> Does he always talk in the third person ? ;-)

Yes, I've heard that he does. :-)

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


Python training in Colorado, January 2007

2006-12-13 Thread Mark Lutz
Python author and trainer Mark Lutz will be teaching another
3-day Python class at a conference center in Longmont, Colorado,
on January 23-25, 2007.

This is a public training session open to individual enrollments,
and covers the same topics as the 3-day onsite sessions that Mark
teaches, with hands-on lab work.

For more information on this, and our other 2007 public classes,
please visit these web pages:

http://home.earthlink.net/~python-training/longmont-public-classes.htm

http://home.earthlink.net/~python-training/public_classes.html

Thanks for your interest.
--Python Training Services, Inc.

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


logging

2006-12-14 Thread Lutz Steinborn
Hello,

I need to log each and only this loglevel to a different file.
So for example all INFO to info.log and all ERROR to error.log.

And I need a master logfile with all messages.

How can I do this ?
Any example ?


Kindly regards

Lutz

http://www.4c-wohnen.de
http://www.4c-parfum.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: CSV Issues

2007-07-18 Thread Lutz Horn
Hi,

On Thu, 19 Jul 2007 06:59:24 +0200, Rohan <[EMAIL PROTECTED]> wrote:
> When I run the script for the second time after a certain period of
> time the results should appear next to the results of the last run,
> I'm unable to make a new column when the script is run after the first
> time.
> Ideally I would like to have an output which looks like this.
> 1/20   1/27
> we.pywe.py
> gh.pygj.py   <- Indicating tht the file has changed
> fg.pyfg.py

Try something like this:

>>> import csv
>>> f = open("/tmp/data.csv", "rb")
>>> reader = csv.reader(f)
>>> headings = reader.next()
>>> headings
['1/20']
>>> rows = []
>>> for row in reader:
... rows.append(row)
...
>>> rows
[['we.py'], ['gh.py'], ['fg.py']]
>>> f.close()
>>> headings.append("1/27")
>>> rows[0].append("we.py")
>>> rows[1].append("gj.py")
>>> rows[2].append("fg.py")
>>> f = open("/tmp/data.csv", "wb")
>>> writer = csv.writer(f)
>>> writer.writerow(headings)
>>> writer.writerows(rows)
>>> f.close()

Regards
Lutz
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class C: vs class C(object):

2007-07-19 Thread Lutz Horn
Hi,

On Thu, 19 Jul 2007 09:40:24 +0200, Bruno Desthuilliers  
<[EMAIL PROTECTED]> wrote:
> there's absolutely no reason to use it no more since "new-style" classes  
> can do anything "Classic" classes did and much more. IOW, don't even  
> bother with old-style classes.

Just for the records: the new and preferred style is

class C(object):
 ...

Regards
Lutz
-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
-- 
http://mail.python.org/mailman/listinfo/python-list


Python training in Colorado, June 2007

2007-04-19 Thread Mark Lutz
Python author and trainer Mark Lutz will be teaching another
3-day Python class at a conference center in Longmont, Colorado,
on June 11-13, 2007.

This is a public training session open to individual enrollments,
and covers the same topics as the 3-day onsite sessions that Mark
teaches, with hands-on lab work.

For more information on this, and our other 2007 public classes,
please visit this web page:

http://home.earthlink.net/~python-training/longmont-public-classes.htm

Thanks for your interest.
--Python Training Services

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


Colorado Python training in October

2007-09-03 Thread Mark Lutz
Python author and trainer Mark Lutz will be teaching another
3-day Python class at a conference center in Longmont, Colorado,
on October 23-25, 2007.

This is a public training session open to individual enrollments,
and covers the same topics as the 3-day onsite sessions that Mark
teaches, with hands-on lab work.

For more information on this class, please visit these web pages:

http://home.earthlink.net/~python-training/longmont-public-classes.htm

Thanks for your interest.
--Python Training Services

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


ANN: Learning Python 3rd Edition

2007-10-29 Thread Mark Lutz
I'm pleased to announce the release of the 3rd Edition of
the book Learning Python.

This new edition has been updated to cover Python 2.5, and
includes numerous pointers for migrating to Python 3.0 in the
future.  Among other things, this edition has been augmented
with material on function decorators, context managers, the
new relative import syntax, generator expressions, and more.

In addition, this edition has been enhanced to be even more
of a self-paced learning resource, with new end-of-chapter
quizzes, new introductory chapters on types and syntax, and
new materials derived from recent Python training sessions.

For more details, see O'Reilly's web page:

http://www.oreilly.com/catalog/9780596513986/

O'Reilly also has a press release about the book here:

http://press.oreilly.com/pub/pr/1843

Thanks,
--Mark Lutz

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


Loading an exe icon into a pixmap/bitmap

2007-12-11 Thread ob . lutz
I've been searching for a way to load an icon from an executable into
something that I can eventually display either through pygame or
pygtk. I've tried the stuff found at
http://groups.google.com/group/comp.lang.python/browse_thread/thread/d7f61f270cce368/3ff38c1ced504e43?lnk=gst&q=win32+icon#3ff38c1ced504e43
but the tests just output all black (not surprising, as that guy
couldn't get it to work either). I've mucked around with taht code and
the ExtractIcon stuff from pywin32, but still am stuck. I've seen some
reference to a wxpython ways to do it, but I'm trying to not have to
convert over to that. Any help is appreciated. Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: plz help how to print python variable using os.system()

2008-01-16 Thread Lutz Horn
Hi,

On Wed, 16 Jan 2008 05:29:08 -0800 (PST), [EMAIL PROTECTED] said:
> var = "/home/anonymous"
> os.system("echo $var)

os.system("echo %s" % var)

Lutz
-- 
GnuPG Key: 1024D/6EBDA359 1999-09-20
Key fingerprint = 438D 31FC 9300 CED0 1CDE  A19D CD0F 9CA2 6EBD A359
http://dev-random.dnsalias.net/0x6EBDA35.asc
http://pgp.cs.uu.nl/stats/6EBDA359.html

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


Re: Python help for a C++ programmer

2008-01-16 Thread Lutz Horn
Hi,

On Wed, 16 Jan 2008 06:23:10 -0800 (PST), "mlimber" <[EMAIL PROTECTED]>
said:
> I'm writing a text processing program to process some survey results.
> I'm familiar with C++ and could write it in that, but I thought I'd
> try out Python. I've got a handle on the file I/O and regular
> expression processing, but I'm wondering about building my array of
> classes (I'd probably use a struct in C++ since there are no methods,
> just data).

You could try something like this.

#!/usr/bin/env python

class Response:
def __init__(self, name, age, iData, sData):
self.name = name
self.age = age
self.iData = iData
self.sData = sData

def sourceOfResponses():
return [["you", 42, [1, 2, 3], ["foo", "bar", "baz"]],
["me", 23, [1, 2, 3], ["ham", "spam", "eggs"]]]

if __name__ == "__main__":
responses = []
for input in sourceOfResponses:
response = Response(input.name, input.age,
input.iData, input.sData)
reponses.append(response)

Lutz
-- 
GnuPG Key: 1024D/6EBDA359 1999-09-20
Key fingerprint = 438D 31FC 9300 CED0 1CDE  A19D CD0F 9CA2 6EBD A359
http://dev-random.dnsalias.net/0x6EBDA35.asc
http://pgp.cs.uu.nl/stats/6EBDA359.html

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


Colorado Python training in May

2008-03-18 Thread Mark Lutz
Python author and trainer Mark Lutz will be teaching another
3-day Python class at a conference center in Longmont, Colorado,
on May 14-16, 2008.

This is a public training session open to individual enrollments,
and covers the same topics as the 3-day onsite sessions that Mark
teaches, with hands-on lab work.

For more information on this session, please visit its web page:

http://home.earthlink.net/~python-training/longmont-public-classes.htm

For additional background on the class itself, see our home page:

http://home.earthlink.net/~python-training

Thanks for your interest.
--Mark Lutz at Python Training Services
-- 
http://mail.python.org/mailman/listinfo/python-list


Python training in Colorado, January 27-30

2009-01-04 Thread Mark Lutz
Python author and trainer Mark Lutz will be teaching a 4-day
Python class on January 27-30, in Longmont, Colorado.

This is a public training session open to individual enrollments,
and covers the same topics and hands-on lab work as the onsite
sessions that Mark teaches.  The class provides an in-depth
introduction to both Python and its common applications, and
parallels the instructor's popular Python books.

For more information on this session, please visit its web page:

http://home.earthlink.net/~python-training/2009-public-classes.htm

For additional background on the class itself, see our home page:

http://home.earthlink.net/~python-training

Thanks for your interest,
--Python Training Services
--
http://mail.python.org/mailman/listinfo/python-list


2009 Python class schedule

2008-11-06 Thread Mark Lutz
A page describing our 2009 Python class offerings has just
been posted here:

http://home.earthlink.net/~python-training/2009-public-classes.htm

The first class in 2009 will be held January 27-30 in
Colorado, and is now open for enrollments.

These are public classes, open to individuals.  They provide
in-depth and hands-on introductions to Python and its common
applications, and are based upon the instructor's popular
Python books.

Thanks for your interest,
--Mark Lutz at Python Training
--
http://mail.python.org/mailman/listinfo/python-list


Re: computing with characters

2008-04-29 Thread Lutz Horn
Hi,

2008/4/30 Gary Herron <[EMAIL PROTECTED]>:
> SL wrote:
> > How can I compute with the integer values of characters in python?
> > Like 'a' + 1 equals 'b' etc
>
>  You can get an integer value from a character with the ord() function.

So just for completion, the solution is:

>>> chr(ord('a') + 1)
'b'

Lutz

-- 
Do you want a Google Mail invitation? Just write me an email!
--
http://mail.python.org/mailman/listinfo/python-list


Re: sed to python: replace Q

2008-04-29 Thread Lutz Horn
Hi,

2008/4/30 Raymond <[EMAIL PROTECTED]>:
> For some reason I'm unable to grok Python's string.replace() function.

replace() does not work with regular expressions.

>  Is there a decent description of string.replace() somewhere?

Use re.sub().

>>> import re
>>> line = "date process text [ip] more text"
>>> re.sub('].*$', '', re.sub('^.*\[', '', line, 1))
'ip'

Lutz
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with variables assigned to variables???

2008-04-29 Thread Lutz Horn
Hi,

2008/4/30  <[EMAIL PROTECTED]>:
>  mylist = ('name1', 'name2', 'name3')
>
>  I also assigned variables for each SQL expression:
>  name1 = "\"field_a\" LIKE '021'"
>  name2 = "\"field_a\" LIKE '031'"
>  name3 = "\"field_a\" LIKE '041'"

>  my intended output is:
>  name1.shp "field_a LIKE '021'
>  name2.shp "field_a LIKE '031'
>  name3.shp "field_a LIKE '041'

You should use a dictionary someway like this:

>>> mydict = {'name1':"\"field_a\" LIKE '021'",
... 'name2':"\"field_a\" LIKE '031'",
... 'name3':"\"field_a\" LIKE '041'"}
>>> for key, value in mydict.items():
... print key, value
...
name2 "field_a" LIKE '031'
name3 "field_a" LIKE '041'
name1 "field_a" LIKE '021'

Lutz

-- 
Do you want a Google Mail invitation? Just write me an email!
--
http://mail.python.org/mailman/listinfo/python-list


Python training in Colorado, October 15-17

2008-09-09 Thread Mark Lutz
Python author and trainer Mark Lutz will be teaching another
3-day Python class at a conference center in Longmont, Colorado,
on October 15-17, 2008.

This is a public training session open to individual enrollments,
and covers the same topics as the 3-day onsite sessions that Mark
teaches, with hands-on lab work.  The class provides an in-depth
introduction to Python and its common applications, and parallels
the instructor's popular Python books.

For more information on this session, please visit its web page:

http://home.earthlink.net/~python-training/longmont-public-classes.htm

For additional background on the class itself, see our home page:

http://home.earthlink.net/~python-training

Thanks for your interest.
--Python Training Services
--
http://mail.python.org/mailman/listinfo/python-list


Re: whitespace in xml output

2009-12-08 Thread Lutz Horn
Hi,

wadi wadi  wrote:
> I am creating some xml output using minidom and saving it to a file
> using doc.writexml()

Could you please add some code of *how* you add the content "bill
catman" to the "Author" element? It seems as if whitespace is an issue
here.

Lutz
-- 
http://mail.python.org/mailman/listinfo/python-list


Python training in Florida, January 19-21

2009-12-16 Thread Mark Lutz
Don't miss your chance to attend our upcoming Florida
Python training class next month.  This 3-day public
class is being held January 19-21, in Sarasota, Florida.
It is open to both individual and group enrollments.

For more details on the class, as well as registration
instructions, please visit the class web page:

http://home.earthlink.net/~python-training/2010-public-classes.html

If you are unable to attend in January, our next
Sarasota class is already scheduled for April 6-8.

Thanks, and we hope to see you at a Python class in
sunny and warm Florida soon.

--Mark Lutz at Python Training Services
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: reading from pipe

2010-01-25 Thread Lutz Horn
Hi,

Richard Lamboj schrieb:
> is there any solution to catch if a pipe has closed? Maybe the signal modul?

Since sys.stdin is a file object, you can use sys.stdin.closed to check
if it has been closed.

Lutz
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to print zero-padded floating point numbers in python 2.6.1

2009-11-04 Thread Lutz Horn
Lorenzo Di Gregorio schrieb:
> print '%2.2F' % 3.5
> 3.50
> print '%02.2F' % 3.5
> 3.50
> 
> How can I get print (in a simple way) to print 03.50?

print '%05.2F' % 3.5

Lutz
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to test urllib|urllib2-using code?

2009-11-04 Thread Lutz Horn
Hi,

kj wrote:
> I want to write some tests for code that uses both urllib and
> urllib2.

Take a look at the discussion under the title "How can one mock/stub
python module like urllib" at stackoverflow:

http://stackoverflow.com/questions/295438/how-can-one-mock-stub-python-module-like-urllib

Lutz
-- 
http://mail.python.org/mailman/listinfo/python-list


Python training in Florida, April 27-29

2010-03-02 Thread Mark Lutz
Tired of the Winter weather?  Make your plans now to
attend our upcoming Florida Python training seminar
in April.  This 3-day public class will be held on
April 27-29, in Sarasota, Florida.  It is open to
both individual and group enrollments.

For more details on the class, as well as registration
instructions, please visit the class web page:

http://learning-python.com/2010-public-classes.html

Note that we have moved to a new domain name.  If you
are unable to attend in April, our next Sarasota class
is already scheduled for July 13-15.

Thanks, and we hope to see you at a Python class in
sunny and warm Florida soon.

--Mark Lutz at learning-python.com
-- 
http://mail.python.org/mailman/listinfo/python-list


upcoming Python training in Florida, April 27-29

2010-04-06 Thread Mark Lutz
Greetings Python fans,

Don't miss your chance to attend our upcoming Florida
Python training seminar later this month. This 3-day
public class will be held on April 27-29, in Sarasota,
Florida.  It is open to both individuals and groups.

For more details on the class, as well as registration
instructions, please visit the class web page:

http://learning-python.com/2010-public-classes.html

If you are unable to attend in April, our next Sarasota
class is already scheduled for July 13-15.

Thanks, and we hope to see you at a Python class in
Florida soon.

--Mark Lutz (lutz at learning-python.com)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Lutz Horn
Hi,

Nick schrieb:
> I've seen a lot of posts on this problem, but none seems to help.

Could you please post a sample input file and the exact error message?

Thanks
Lutz
-- 
Strike Out ⇒ http://www.fourmilab.ch/documents/strikeout
-- 
http://mail.python.org/mailman/listinfo/python-list


Florida Python training in October

2009-08-10 Thread Mark Lutz
We're pleased to announce a new venue for our Python classes.
Python author and trainer Mark Lutz will be teaching a 3-day
Python class on October 20-22, in Sarasota, Florida.  Come
spend 3 days mastering Python, and enjoy all that Florida and
its Gulf Coast have to offer while you're here.

This is a public training session open to individual enrollments,
and covers the same topics and hands-on lab work as the over 200
onsite sessions that Mark has taught.  The class provides an
in-depth introduction to both Python and its common applications,
and parallels the instructor's best-selling Python books.

This class is also newly retooled to cover recent changes in
both Python 2.6 and 3.1.  Whether you're using 2.X, using 3.X,
or stuck somewhere between them, you'll find that our class is
aimed at your needs.  For more information on this session,
please visit its web page:

http://home.earthlink.net/~python-training/2009-public-classes.htm

For additional background on the class itself, as well as a
preview of our 2010 Florida class schedule, see our home page:

http://home.earthlink.net/~python-training

Thanks for your interest,
--Mark Lutz's Python Training Services
-- 
http://mail.python.org/mailman/listinfo/python-list


Pythons in Florida (training next month)

2009-09-21 Thread Mark Lutz
Don't miss your chance to attend our first Florida
Python training session next month.  This 3-day class
is being held October 20-22, in Sarasota, Florida.
It is open to both individual and group enrollments.

For more details on the class, as well as registration
instructions, please visit the class web page:

http://home.earthlink.net/~python-training/2009-public-classes.htm

If you are unable to attend in October, our next
Sarasota class is already scheduled for January 19-21.

Thanks, and we hope to see you in sunny Florida soon.

--Mark Lutz at Python Training Services


*Prerequisite reading:
http://edition.cnn.com/2009/US/03/30/python.patrol/index.html
-- 
http://mail.python.org/mailman/listinfo/python-list


New books: Learning Python, Python Pocket Reference 4th Eds

2009-09-25 Thread Mark Lutz
I'm happy to announce new, 4th editions of the O'Reilly books
Learning Python and Python Pocket Reference.

These new editions have been thoroughly updated and expanded
to cover both Python 3.1 and 2.6, and fully present features
that appear in each Python line.  Whether you're using Python
2.X, using Python 3.X, or stuck somewhere in between, you'll
find these editions tailored to your current and future needs.

In addition to language changes, the new Learning Python has
been augmented with a new OOP tutorial chapter, as well as
new advanced topic chapters that explore Unicode processing,
managed attributes, decorators, and metaclasses.

For a more detailed description of the changes in the new
Learning Python, please see the early draft Preface excerpt:

http://www.rmi.net/~lutz/lp4e-preface-preview.html

For more details on both books, see O'Reilly's web pages:

http://oreilly.com/catalog/9780596158064/
http://oreilly.com/catalog/9780596158088/

I also maintain pages about these books at:

http://www.rmi.net/~lutz

The new Learning Python is available today, in both paper and
a variety of ebook and online forms; the Pocket Reference is
printing and will be available shortly.

Cheers,
--Mark Lutz
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SimpleHTTPServer and CgiHTTPServer in practice

2017-03-16 Thread Lutz Horn

Some Python users have told me that isn't a good idea, but
without any specifics.


We don't know *why* those people told you not to use these modules. We 
also don't know your use case. So it is very hard to advise you.


Lutz

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


Re: How to add a built-in library in pyhton

2017-03-17 Thread Lutz Horn

Am 17.03.2017 05:08 schrieb chenchao:

   I use python2.7.10 and want to add a c language library in python.
So how can i built it as a built-in module in python?


Why do you want to build it as a built-in module? Why not a simple 
module as described on https://docs.python.org/2/extending/index.html ?


Lutz

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


Re: Who are the "spacists"?

2017-03-18 Thread Lutz Horn
Am 18.03.17 um 16:18 schrieb Mikhail V:
> On 18 March 2017 at 05:02, Ben Finney 
> wrote:
>> Mikhail V  writes:
>> 
>>> I think it would be a salvation to forbid spaces for indentation,
>>> did such attemps take place?
>> 
>> Feel free to start your own discussion forum for your new
>> programming language that forbids spaces for indentation. That
>> language will never be Python, so please don't ask us to discuss it
>> here.

> So you are the opinion it would be more productive to invent a new
> language instead of just cleaning up spaces?

Productive in solving what problem exactly? Why do you think a cleaning
of spaces is necessary?

> I think it still helps to realize that in the future this will become
> more noticable problem than it seems now

Why? What could be the problem? I fail to see how the Python policy of
preferring spaces over tabs while allowing both if used consistent is
causing any problem.

Lutz



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Practice Python

2017-05-08 Thread Lutz Horn

Python - Exercise 5


Do you want us to solve these problems for you?


The answers here:

https://www.youtube.com/watch?v=nwHPM9WNyw8&t=36s


A strange way to publish code.

Lutz





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


Re: packaging python code

2017-05-08 Thread Lutz Horn

Is there any way to pack my .py with all required libraries and create a self 
running package?


Take a look at PyInstaller:

* http://www.pyinstaller.org/
* https://pyinstaller.readthedocs.io/en/stable/

Lutz


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


Re: [GIS] Keeping only POIs X kms from a trace?

2017-05-08 Thread Lutz Horn

Problem is, files are only country-size, so the number of waypoints is 
overwhelming (Here's the UK for instance**).


How many is 'overwhelming'?

Lutz

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


Re: help with an error msg please

2017-05-14 Thread Lutz Horn
> $ PYTHONPATH= python  except
> Traceback (most recent call last):
>   File "except", line 7, in 
> except getopt.error, msg:
> AttributeError: 'module' object has no attribute 'error'
> 
> 
> The program is:
> 
> $ cat  except
> #!/usr/bin/env python
> 
> import getopt
> 
> try:
> opts, args = getopt.getopt (sys.argv[1:], "t:")
> except getopt.error, msg:
> raise "Usage: some other way", msg

I guess you are using Python 2.

In any case you should

import sys

if you want to access sys.argv.

Lutz



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: little help in homework required

2017-06-16 Thread Lutz Horn

Hi,


TypeError: a bytes-like object is required, not 'str'

...

mysock.send('GET http://data.pr4e.org/intro-short.txt HTTP/1.0\n\n')


Here you must encode the str as bytes:

mysock.send('GET http://data.pr4e.org/intro-short.txt 
HTTP/1.0\n\n'.encode("UTF-8"))


The actual encoding does not matter in your case since you only have 
ASCII.



data =x.recv(512)


This gives the next error:

NameError: name 'x' is not defined

What is x supposed to be?

Regards

Lutz


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