[ANN]: Simple 0.6 (Lightweight python markdown blog)

2013-03-01 Thread tom Tom
Simple 0.6 has been released and is available from
https://github.com/orf/simple

Whats new in 0.6?
---
  * Redesigned editing interface (http://i.imgur.com/KkGtlTx.png)
  * Drag and drop image uploads
  * Better settings migration support

What is Simple?
---
Simple is a lightweight python blog. Its designed to be simple - no fussy
WYSIWYG editors or clutter, you simply write your post in markdown into the
editor and publish.
It consists of only 1 file (excluding resources), has a limited number of
pure-python dependencies, is fast and easy to deploy.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


tox-1.4.3: quickstart command, -l option and fixes

2013-03-01 Thread holger krekel
tox 1.4.3: the Python virtualenv-based testing automatizer
=

tox 1.4.3 fixes some bugs and introduces a new script and two new options:

- tox-quickstart - run this script, answer a few questions, and
  get a tox.ini created for you (thanks Marc Abramowitz)

- tox -l lists configured environment names (thanks Lukasz Balcerzak)

- (experimental) --installpkg=localpath option which will skip the
  sdist-creation of a package and instead install the given localpath package.

- use pip-script.py instead of pip.exe on win32 to avoid windows locking
  the .exe

Note that the sister project detox should continue to work - it's a 
separately released project which drives tox test runs on multiple CPUs
in parallel.

More documentation:

http://tox.testrun.org/

Installation:

pip install -U tox

repository hosting and issue tracking on bitbucket:

https://bitbucket.org/hpk42/tox


What is tox?


tox standardizes and automates tedious python driven test activities
driven from a simple ``tox.ini`` file, including:

* creation and management of different virtualenv environments 
  with different Python interpreters
* packaging and installing your package into each of them
* running your test tool of choice, be it nose, py.test or unittest2 or other 
tools such as sphinx doc checks
* testing dev packages against each other without needing to upload to PyPI

best,
Holger Krekel


CHANGELOG


1.4.3 (compared to 1.4.2)


- introduce -l|--listenv option to list configured environments
  (thanks  Lukasz Balcerzak)

- fix downloadcache determination to work according to docs: Only
  make pip use a download cache if PIP_DOWNLOAD_CACHE or a 
  downloadcache=PATH testenv setting is present. (The ENV setting
  takes precedence)

- fix issue84 - pypy on windows creates a bin not a scripts venv directory
  (thanks Lukasz Balcerzak)

- experimentally introduce --installpkg=PATH option to install a package rather 
than
  create/install an sdist package.  This will still require and use
  tox.ini and tests from the current working dir (and not from the remote
  package).

- substitute {envsitepackagesdir} with the package installation directory 
(closes #72)
  (thanks g2p)

- issue #70 remove PYTHONDONTWRITEBYTECODE workaround now that
  virtualenv behaves properly (thanks g2p)

- merged tox-quickstart command, contributed by Marc Abramowitz, which
  generates a default tox.ini after asking a few questions

- fix #48 - win32 detection of pypy and other interpreters that are on PATH
  (thanks Gustavo Picon)

- fix grouping of index servers, it is now done by name instead of 
  indexserver url, allowing to use it to separate dependencies
  into groups even if using the same default indexserver.

- look for tox.ini files in parent dirs of current dir (closes #34)

- the py environment now by default uses the current interpreter
  (sys.executable) make tox' own setup.py test execute tests with it
  (closes #46)

- change tests to not rely on os.path.expanduser (closes #60),
  also make mock session return args[1:] for more precise checking (closes #61)
  thanks to Barry Warszaw for both.

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

Support the Python Software Foundation:
http://www.python.org/psf/donations/


[ANN] PyLint 0.27 / logilab-astng 0.24.2

2013-03-01 Thread Sylvain Thénault
Hi there,

I'm very pleased to announce the release of pylint 0.27 [1] and
logilab-astng 0.24.2 [2] . There has been a lot of enhancements and
bug fixes since the latest release, so you're strongly encouraged
to upgrade. See ChangeLog for details.

Many thanks to all the people who contributed to this release!

[1] http://www.logilab.org/project/pylint/0.27.0 /
[2] http://www.logilab.org/project/logilab-astng/0.24.2

Enjoy!
-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:   http://www.logilab.fr/services
CubicWeb, the semantic web framework:http://www.cubicweb.org
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


WebElements - QT Inspired web development framework for python released

2013-03-01 Thread timothy . crosley
Hi Everyone, 

I've been working on a web development framework that integrates several 
popular QT features (such as a graphical template builder, signal / slots, ui's 
built by objects) for the last few years, and I was hoping that some people 
here might find it useful. 

If you are interested the main link for the widgets is 
http://www.webelements.in 
and the link for the framework overall is http://www.webbot.ws 

Thanks! 

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

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Re: Issue with continous incrementing of unbroken sequence for a entire working day

2013-03-01 Thread Chris Angelico
On Fri, Mar 1, 2013 at 6:50 PM, Morten Engvoldsen mortene...@gmail.com wrote:
 Hi,
 No i don't want user to blame when date is changed and serial number
 reset when it should not. Do you think the following function will
 help for this:

 import datetime as dt
 import pytz
 utc = pytz.timezone(UTC)
 norway = pytz.timezone(Europe/Norway)
 a = dt.datetime(2008, 7, 6, 5, 4, 3, tzinfo=utc)
 b = a.astimezone(norway)

 Your suggestion is really appreciated..

(posting reply on-list, hope that's okay!)

That would be fine for the normal case. It's just possible that the
user will change the computer's clock, which would result in the
serial changing oddly. If that's not a problem to you, the job's done!

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


Re: Having problems crashing IDLE

2013-03-01 Thread Peter Otten
Quintessence wrote:

 I've been learning Python over the past week or so and I keep running into
 an issue where opening saved files will crash IDLE (not consistently,
 sometimes the same files with no changes will open and sometimes not). I
 was originally running Python 3.2.3, but I removed it and upgraded to
 3.3.0 hoping to resolve the issue (but to no avail). While
 troubleshooting, someone suggested I try opening IDLE via command prompt.
 When I do that IDLE never crashes, but It does show this error
 (screenshot): http://i.imgur.com/1JqiRsY.png (3.2.3)
 http://i.imgur.com/5KxE88K.png (3.3.0)

Your posts are easier to deal with if you provide tracebacks as text. 
Here's what I get:

Exception in Tkinter callback
Traceback (most recent call last):
  File /usr/local/lib/python3.3/tkinter/__init__.py, line 1442, in 
__call__
return self.func(*args)
  File /usr/local/lib/python3.3/idlelib/MultiCall.py, line 174, in handler
doafterhandler.pop()()
  File /usr/local/lib/python3.3/idlelib/MultiCall.py, line 221, in 
lambda
doit = lambda: self.bindedfuncs[triplet[2]][triplet[0]].remove(func)
ValueError: list.remove(x): x not in list

 Some additional info:
 - When IDLE crashes it does not display an error, every open window simply
 closes. - IDLE has never crashed after opening a file when I open it via
 command prompt, even if it was previously consistently displaying that
 behavior. - I am running Windows 7 x64 with all updates.
 
 Has anyone ever encountered this? What does the error mean?

This looks like the following bug:

http://bugs.python.org/issue8900

You might be able to work around it by selecting the

At Startup Open Shell Window option under

Options--Configure IDLE--General--Startup Preferences


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


Re: How would you do this?

2013-03-01 Thread Jean-Michel Pichavant


- Original Message -
 How would you find the slope, y intercept, and slope-intercept form
 equation for a line in python?
 --
 http://mail.python.org/mailman/listinfo/python-list
 

See http://docs.scipy.org/doc/scipy/reference/interpolate.html


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


In win32 and linux platform, os modules has diffreent output order, is it a bug?

2013-03-01 Thread Honghe Wu
env: python 2.7.3

6 test files' name in a directory as below:
12ab  Abc  Eab  a1bc  acd  bc

the following is test code:
for root, dirs, files in os.walk(os.getcwd()):
print files

the output in win32 platform is:
['12ab', 'a1bc', 'Abc', 'acd', 'bc', 'Eab']

but in linux is:
['Eab', 'acd', 'a1bc', '12ab', 'bc', 'Abc' ]

they are so different. a bug?
-- 
http://mail.python.org/mailman/listinfo/python-list


Triple nested loop python (While loop insde of for loop inside of while loop)

2013-03-01 Thread Isaac Won
try to make my triple nested loop working. My code would be:
c = 4
y1 = []
m1 = []
std1 = []
while c 24:
c = c + 1
a = []
f.seek(0,0)
for columns in ( raw.strip().split() for raw in f ):
a.append(columns[c])
x = np.array(a, float)
not_nan = np.logical_not(np.isnan(x))
indices = np.arange(len(x))
interp = interp1d(indices[not_nan], x[not_nan], kind = 'nearest')
p = interp(indices)

N = len(p)
dt = 900.0 #Time step (seconds)
fs = 1./dt #Sampling frequency
KA,PSD = oned_Fourierspectrum(p,dt) # Call Song's 1D FS function
time_axis = np.linspace(0.0,N,num = N,endpoint = False)*15/(60*24) 
plot_freq = 24*3600.*KA #Convert to cycles per day 
plot_period = 1.0/plot_freq # convert to days/cycle
fpsd = plot_freq*PSD
d = -1 
while d 335: 
d = d + 1 
y = fpsd[d] 
y1 = y1 + [y]   
   m = np.mean(y1)
m1 = m1 + [m]
print m1


My purpose is make a list of [mean(fpsd[0]), mean(fpsd[1]), mean(fpsd[2]).. 
mean(fpsd[335])]. Each y1 would be the list of fpsd[d].

I check it is working pretty well before second while loop and I can get 
individual mean of fpsd[d]. However, with second whole loop, it produces 
definitely wrong numbers. Would you help me this problem?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: In win32 and linux platform, os modules has diffreent output order, is it a bug?

2013-03-01 Thread Benjamin Kaplan
On Fri, Mar 1, 2013 at 12:43 AM, Honghe Wu leopards...@gmail.com wrote:
 env: python 2.7.3

 6 test files' name in a directory as below:
 12ab  Abc  Eab  a1bc  acd  bc

 the following is test code:
 for root, dirs, files in os.walk(os.getcwd()):
 print files

 the output in win32 platform is:
 ['12ab', 'a1bc', 'Abc', 'acd', 'bc', 'Eab']

 but in linux is:
 ['Eab', 'acd', 'a1bc', '12ab', 'bc', 'Abc' ]

 they are so different. a bug?
 --

The function doesn't specify a particular order, just that it will
hand you a list of files. It grabs those from the underlying file
system. It looks like Windows sorts it alphabetically and Linux just
does whatever (maybe sorted by creation time?). I don't think it's a
bug. If the order matters to you, sort it yourself.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: In win32 and linux platform, os modules has diffreent output order, is it a bug?

2013-03-01 Thread Chris Rebert
On Fri, Mar 1, 2013 at 12:43 AM, Honghe Wu leopards...@gmail.com wrote:
 env: python 2.7.3

 6 test files' name in a directory as below:
 12ab  Abc  Eab  a1bc  acd  bc

 the following is test code:
 for root, dirs, files in os.walk(os.getcwd()):
 print files

 the output in win32 platform is:
 ['12ab', 'a1bc', 'Abc', 'acd', 'bc', 'Eab']

 but in linux is:
 ['Eab', 'acd', 'a1bc', '12ab', 'bc', 'Abc' ]

 they are so different. a bug?

Nope. When os.walk() fetches a listing of the contents of a directory,
it internally uses os.listdir() (or a moral equivalent thereof). The
docs for os.listdir() state that The [returned] list is in arbitrary
order.. The order is dependent on the OS and filesystem, and likely
also more obscure factors (e.g. the order in which the files were
created). The lack of any required ordering allows for improved I/O
performance in many/most cases.

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


Re: In win32 and linux platform, os modules has diffreent output order, is it a bug?

2013-03-01 Thread Honghe Wu
Thanks! Cause I need sorted returnd list, and the arbitrary list makes the
other procedure go wrong. Maybe the I/O speed is more important in other
cases.
On Mar 1, 2013 4:55 PM, Chris Rebert c...@rebertia.com wrote:

 On Fri, Mar 1, 2013 at 12:43 AM, Honghe Wu leopards...@gmail.com wrote:
  env: python 2.7.3
 
  6 test files' name in a directory as below:
  12ab  Abc  Eab  a1bc  acd  bc
 
  the following is test code:
  for root, dirs, files in os.walk(os.getcwd()):
  print files
 
  the output in win32 platform is:
  ['12ab', 'a1bc', 'Abc', 'acd', 'bc', 'Eab']
 
  but in linux is:
  ['Eab', 'acd', 'a1bc', '12ab', 'bc', 'Abc' ]
 
  they are so different. a bug?

 Nope. When os.walk() fetches a listing of the contents of a directory,
 it internally uses os.listdir() (or a moral equivalent thereof). The
 docs for os.listdir() state that The [returned] list is in arbitrary
 order.. The order is dependent on the OS and filesystem, and likely
 also more obscure factors (e.g. the order in which the files were
 created). The lack of any required ordering allows for improved I/O
 performance in many/most cases.

 Cheers,
 Chris

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


Re: Twisted or Tornado?

2013-03-01 Thread Sven
Although these articles are a _little_ old they are probably useful to help
you decide which solution is most suitable for you in terms of performance

http://nichol.as/benchmark-of-python-web-servers
http://nichol.as/asynchronous-servers-in-python

I would also be interested if any one on this list has any idea if the
results above would be any different these days or whether the benchmarks
are still fairly representative.


On 1 March 2013 00:28, Jake Angulo jake.ang...@gmail.com wrote:

 I have to say it first: I am not trolling :P

 Im working on a server project (with IOS client) and would like to create
 a custom, lean and mean server - real Quick!

 My requirements for this framework in descending order:
 1) Easy to use API
 2) Widely available documentation / Examples / Community contributions
 3) Feature-wise - kinda most that you commonly need is there

 Your opinions will be valuable, if possible cite examples or URL
 references, Pls!

 I prefer opinion from those who have programmed real projects in it - not
 just read some blog or Slashdot :P
 --
 http://mail.python.org/mailman/listinfo/python-list




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


Re: Issue with continous incrementing of unbroken sequence for a entire working day

2013-03-01 Thread Morten Engvoldsen
Hi,
Thanks.. :)
so simply i can use time.strftime(%d%-m-%y  %H:%M)  , and then i can
compare the date


-- Forwarded message --
From: Chris Angelico ros...@gmail.com
To: python-list@python.org
Cc:
Date: Fri, 1 Mar 2013 18:59:16 +1100
Subject: Re: Issue with continous incrementing of unbroken sequence
for a entire working day
On Fri, Mar 1, 2013 at 6:50 PM, Morten Engvoldsen mortene...@gmail.com wrote:
 Hi,
 No i don't want user to blame when date is changed and serial number
 reset when it should not. Do you think the following function will
 help for this:

 import datetime as dt
 import pytz
 utc = pytz.timezone(UTC)
 norway = pytz.timezone(Europe/Norway)
 a = dt.datetime(2008, 7, 6, 5, 4, 3, tzinfo=utc)
 b = a.astimezone(norway)

 Your suggestion is really appreciated..

(posting reply on-list, hope that's okay!)

That would be fine for the normal case. It's just possible that the
user will change the computer's clock, which would result in the
serial changing oddly. If that's not a problem to you, the job's done!

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


Failure of Python devs to deliver - Battle Police SIG

2013-03-01 Thread Mark Lawrence

Hi all,

It has become quite clear over the years that Python developers aren't 
doing enough to push the language forward.  A Battle Police SIG will 
therefore be needed.  Their sole task will be to ensure that all the 
volunteers spend their time working on Python and not frivilous pursuits 
like day jobs or leisure activities.  The colours will be raised outside 
of RR's home at 05:00 Saturday 02/03/2013.


For more data please contact RR directly, not me.

--
Cheers.

Mark Lawrence

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


RE: Twisted or Tornado?

2013-03-01 Thread Andriy Kornatskyy

The following benchmarks are related to:

a) python web frameworks
http://mindref.blogspot.com/2012/09/python-fastest-web-framework.html
http://mindref.blogspot.com/2012/10/python-web-routing-benchmark.html
http://mindref.blogspot.com/2012/10/python-web-reverse-urls-benchmark.html
http://mindref.blogspot.com/2012/10/python-web-caching-benchmark.html

b) template engines
http://mindref.blogspot.com/2012/10/python-templates-benchmark.html
http://mindref.blogspot.com/2012/07/python-fastest-template.html

With source code:
https://bitbucket.org/akorn/helloworld

Thanks.

Andriy Kornatskyy



 Date: Fri, 1 Mar 2013 09:25:43 + 
 Subject: Re: Twisted or Tornado? 
 From: sven...@gmail.com 
 To: jake.ang...@gmail.com 
 CC: python-list@python.org 
 
 Although these articles are a _little_ old they are probably useful to 
 help you decide which solution is most suitable for you in terms of 
 performance 
 
 http://nichol.as/benchmark-of-python-web-servers 
 http://nichol.as/asynchronous-servers-in-python 
 
 I would also be interested if any one on this list has any idea if the 
 results above would be any different these days or whether the 
 benchmarks are still fairly representative. 
 
 
 On 1 March 2013 00:28, Jake Angulo 
 jake.ang...@gmail.commailto:jake.ang...@gmail.com wrote: 
 I have to say it first: I am not trolling :P 
 
 Im working on a server project (with IOS client) and would like to 
 create a custom, lean and mean server - real Quick! 
 
 My requirements for this framework in descending order: 
 1) Easy to use API 
 2) Widely available documentation / Examples / Community contributions 
 3) Feature-wise - kinda most that you commonly need is there 
 
 Your opinions will be valuable, if possible cite examples or URL 
 references, Pls! 
 
 I prefer opinion from those who have programmed real projects in it - 
 not just read some blog or Slashdot :P 
 -- 
 http://mail.python.org/mailman/listinfo/python-list 
 
 
 
 -- 
 ./Sven 
 
 -- http://mail.python.org/mailman/listinfo/python-list 
  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Store a variable permanently

2013-03-01 Thread Jean-Michel Pichavant
- Original Message -
 So i have a variable called funds that i want to store the value of
 even after the program is exited. My funds variable holds the total
 value of funds i have. I add a certain number of funds each time i
 run the program by entering how much i want to add. How would i
 store the funds variable to keep its value?
 --
 http://mail.python.org/mailman/listinfo/python-list
 

Hi,

I would serialize the data.

http://docs.python.org/2/library/pickle.html

funds=5
pickle.dump(funds, 'funds.pickle')

# to reload funds:

funds = pickle.load('funds.pickle')


The good thing with pickle is that it serializes a lot of things, see the What 
can be pickled section of the doc.


JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Issue with continous incrementing of unbroken sequence for a entire working day

2013-03-01 Thread Morten Engvoldsen
Hi,
I have wrote the below code for getting the serial number: look like i
am able to get correct serial number:

from datetime import date

def read_data_file():
with open(workfile.txt, 'r') as f:
for line in f.readlines():
read_data = line.split(' ')
return read_data

def write_data_file(data):
fo = open(workfile.txt, w)
fo.write(str(data))
fo.close()

def comput_date(read_date, now_time, read_serial):
if read_date == now_time:
read_serial = int(read_serial)
return read_serial + 1
else:
read_serial = 1
return read_serial

def process_sales_record():
now_time = time.strftime(%d-%m-%y)
readdata = read_data_file()
if readdata:
read_serial = readdata[0]
read_date = readdata[1]
copute_date = comput_date(read_date, now_time, read_serial)
serial_number = copute_date
print serial_number
sales_recrod = {'record1':'product1',
'record2':'product2','record3':'product3'}
for i in sales_recrod:
print sales_recrod[i]
serial_number += 1
print serial_number
data = str(serial_number) + ' ' + now_time
writedata = write_data_file(data)
print readdata

Kindly suggest how can i improve this code now or is it okey in this way..

On Fri, Mar 1, 2013 at 10:42 AM, Morten Engvoldsen mortene...@gmail.com wrote:
 Hi,
 Thanks.. :)
 so simply i can use time.strftime(%d%-m-%y  %H:%M)  , and then i can
 compare the date


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


Re: Do you feel bad because of the Python docs?

2013-03-01 Thread Jean-Michel Pichavant
[snip hostile replies]

It's somehow funny to read such posts on a thread about someone complaining 
about the community python being hostile.
I think we should really try to resist the urge of answering trolls because no 
matter how many times we slap them, they'll stay trolls and probably get even 
bigger.

Instead, we take revenge by helping someone asking us to do his homework and 
show the world how merciful the python community is.

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Triple nested loop python (While loop insde of for loop inside of while loop)

2013-03-01 Thread Ulrich Eckhardt

Am 01.03.2013 09:59, schrieb Isaac Won:

try to make my triple nested loop working. My code would be:
c = 4

[...]

while c 24:
 c = c + 1


This is bad style and you shouldn't do that in python. The question that 
comes up for me is whether something else is modifying c in that loop, 
but I think the answer is no. For that reason, use Python's way:


  for c in range(5, 25):
  ...

That way it is also clear that the first value in the loop is 5, while 
the initial c = 4 seems to suggest something different. Also, the last 
value is 24, not 23.





 while d 335:
 d = d + 1
 y = fpsd[d]
 y1 = y1 + [y]
m = np.mean(y1)
 m1 = m1 + [m]


Apart from the wrong indention (don't mix tabs and spaces, see PEP 8!) 
and the that d in range(336) is better style, you don't start with an 
empty y1, except on the first iteration of the outer loop.


I'm not really sure if that answers your problem. In any case, please 
drop everything not necessary to demostrate the problem before posting. 
This makes it easier to see what is going wrong both for you and others. 
Also make sure that others can actually run the code.



Greetings from Hamburg!

Uli



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


Re: In win32 and linux platform, os modules has diffreent output order, is it a bug?

2013-03-01 Thread Nobody
On Fri, 01 Mar 2013 17:24:05 +0800, Honghe Wu wrote:

 Thanks! Cause I need sorted returnd list, and the arbitrary list makes the
 other procedure go wrong. Maybe the I/O speed is more important in other
 cases.

You can sort the lists of files and subdirectories with e.g.:

for root, dirs, files in os.walk(os.getcwd()):
dirs[:] = sorted(dirs)
files = sorted(files)
...

Note that modifying the directory list in-place will affect which
subdirectories are traversed and in what order.

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


Re: Triple nested loop python (While loop insde of for loop inside of while loop)

2013-03-01 Thread Joel Goldstick
On Fri, Mar 1, 2013 at 7:00 AM, Ulrich Eckhardt 
ulrich.eckha...@dominolaser.com wrote:

 Am 01.03.2013 09:59, schrieb Isaac Won:

  try to make my triple nested loop working. My code would be:
 c = 4

 [...]

  while c 24:
  c = c + 1


 This is bad style and you shouldn't do that in python. The question that
 comes up for me is whether something else is modifying c in that loop,
 but I think the answer is no. For that reason, use Python's way:

   for c in range(5, 25):
   ...

 That way it is also clear that the first value in the loop is 5, while the
 initial c = 4 seems to suggest something different. Also, the last value
 is 24, not 23.



 I concur with Uli, and add the following thoughts:  What is going on with
[y]?  Is this really a list?  So what is y1 + y1 + [y] doing?


   while d 335:
  d = d + 1
  y = fpsd[d]
  y1 = y1 + [y]
 m = np.mean(y1)
  m1 = m1 + [m]


 In your outer loop you initialize these values each pass:

dt = 900.0 #Time step (seconds)
fs = 1./dt #Sampling frequency

This should me moved out of the loop since nothing changes with dt or fs



 Apart from the wrong indention (don't mix tabs and spaces, see PEP 8!) and
 the that d in range(336) is better style, you don't start with an empty
 y1, except on the first iteration of the outer loop.

 I'm not really sure if that answers your problem. In any case, please drop
 everything not necessary to demostrate the problem before posting. This
 makes it easier to see what is going wrong both for you and others. Also
 make sure that others can actually run the code.


 Greetings from Hamburg!

 Uli



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




-- 
Joel Goldstick
http://joelgoldstick.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Triple nested loop python (While loop insde of for loop inside of while loop)

2013-03-01 Thread Chris Angelico
On Fri, Mar 1, 2013 at 7:59 PM, Isaac Won winef...@gmail.com wrote:
 while c 24:
 for columns in ( raw.strip().split() for raw in f ):
 while d 335:

Note your indentation levels: the code does not agree with your
subject line. The third loop is not actually inside your second.
Should it be?

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


Re: text formatting question

2013-03-01 Thread Dave Angel

On 03/01/2013 02:08 AM, idy wrote:

On Friday, March 1, 2013 12:23:41 PM UTC+5:30, Chris Angelico wrote:




  snip


You want to break the line immediately before the 'XYC'? That's quite
easy; the line break is a character like any other, and can be used in
a replace() call:

formatted_error = Error.replace(XYC,\nXYC)

If that's not the case, can you clarify what you need to do to divide it?

Chris Angelico


Chris,

Thanks this works great !!!



The assumption Chris made is that the characters XYC do *not* appear 
anywhere else in each string.  if they do, then you need to write a spec 
as to what criteria you can count on for the data.


If somebody has mangled all those lines into one long string, it's quite 
likely that they CANNOT be reliably separated again.  Chris' suggestion 
is the most likely candidate, but ...

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


Re: text formatting question

2013-03-01 Thread Chris Angelico
On Sat, Mar 2, 2013 at 12:52 AM, Dave Angel da...@davea.name wrote:
 The assumption Chris made is that the characters XYC do *not* appear
 anywhere else in each string.  if they do, then you need to write a spec as
 to what criteria you can count on for the data.


Right. I should have mentioned that. Let's hope the OP is sufficiently
lucky as to have a separator uniqueness..


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


Python Trademark Dispute - Update?

2013-03-01 Thread Giles Coochey
Is there an update on the trademark dispute that was mentioned the other 
week on this list?


I can't help but notice that the .co.uk site that was attempting to 
trademark the Python name no longer returns a homepage, just a 404.


--
Regards,

Giles Coochey, CCNA, CCNAS
NetSecSpec Ltd
+44 (0) 7983 877438
http://www.coochey.net
http://www.netsecspec.co.uk
gi...@coochey.net





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


Re: Issue with continous incrementing of unbroken sequence for a entire working day

2013-03-01 Thread MRAB

On 2013-03-01 09:42, Morten Engvoldsen wrote:

Hi,
Thanks.. :)
so simply i can use time.strftime(%d%-m-%y  %H:%M)  , and then i can
compare the date


I think you're only interested in the date, not the time of day:

time.strftime(%d-%m-%y)

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


os.system() not responding on django... any reason?

2013-03-01 Thread Jaiky
import sys,os
sys.stderr = open('/dev/null')
import paramiko
sys.stderr = sys.__stderr__

os.system(echo \'s3\'  myfile.txt )  #debug first in ssh2
def ssh2_connect(host, user, pswd, port=22):
try:
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, port, user, pswd)
return ssh
except Exception, e:
return str(e) + Error. Failed to connect. Wrong IP/Username/Password


def ssh2_exec(ssh, cmd, sudo=False):
result = []
try:
channel = ssh.get_transport().open_session()
if sudo:
channel.get_pty()
except:
  return result

stdin = channel.makefile('wb')
stdout = channel.makefile('rb')

channel.exec_command(cmd)

exit_status = channel.recv_exit_status()

if exit_status == 0:
for line in stdout:
result.append(line)
channel.close()
return result


def ssh2_close(ssh):
ssh.close()
return


def ssh2_copyToFile(ssh, local_file, remote_file):
sftp = paramiko.SFTPClient.from_transport(ssh.get_transport())
sftp.put(local_file, remote_file)
return
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.system() not responding on django... any reason?

2013-03-01 Thread Roy Smith
In article 4fcc93b7-3be9-416f-a2d4-bdc6cba21...@googlegroups.com,
 Jaiky jaiprakashsingh...@gmail.com wrote:

[a lot of code involving ssh and paramiko]

Here's a few general suggestions:

1) Try to reduce this to the smallest possible amount of code which 
demonstrates the problem.  You gave us a page full of complicated stuff.  
Keep hacking away lines of code that don't change the behavior until you 
get it down to something small and understandable.

2) Try to eliminate environmental problems.  You're running this under 
django?  Does it work as a stand-alone process (i.e. without django)?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [ANN] PyLint 0.27 / logilab-astng 0.24.2

2013-03-01 Thread Melton Low (devl)

Hi Sylvain,

Clicking on the download linked from [1] below gives me an error.  Same 
with logilab-astng link [2].


Not Found

The requested URL /pub/pylint/pylint-0.27.0.tar.gz was not found on this 
server.


Apache/2.2.16 (Debian) mod_ssl/2.2.16 OpenSSL/0.9.8o Server at 
download.logilab.org Port 80


Maybe I need to wait for the server to be updated?

Any idea.

Mel



Sylvain Thénault wrote:

Hi there,

I'm very pleased to announce the release of pylint 0.27 [1] and
logilab-astng 0.24.2 [2] . There has been a lot of enhancements and
bug fixes since the latest release, so you're strongly encouraged
to upgrade. See ChangeLog for details.

Many thanks to all the people who contributed to this release!

[1] http://www.logilab.org/project/pylint/0.27.0 /
[2] http://www.logilab.org/project/logilab-astng/0.24.2

Enjoy!

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


Re: Store a variable permanently

2013-03-01 Thread Michael Torrie
On 03/01/2013 03:19 AM, Jean-Michel Pichavant wrote:
 I would serialize the data.
 
 http://docs.python.org/2/library/pickle.html
 
 funds=5 pickle.dump(funds, 'funds.pickle')
 
 # to reload funds:
 
 funds = pickle.load('funds.pickle')
 
 
 The good thing with pickle is that it serializes a lot of things, see
 the What can be pickled section of the doc.

Another solution is to use a database system.  Either SQLite
(file-based) or something server-based like PosgreSQL or MariaDB.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing to same file from two threads

2013-03-01 Thread Antoine Pitrou
Steven D'Aprano steve+comp.lang.python at pearwood.info writes:
 
 On Wed, 27 Feb 2013 13:26:18 +, Antoine Pitrou wrote:
 
  For the record, binary files are thread-safe in Python 3, but text files
  are not.
 
 Where is this documented please?

In the documentation, of course ;)
http://docs.python.org/3.3/library/io.html#multi-threading

Regards

Antoine.




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


Re: os.system() not responding on django... any reason?

2013-03-01 Thread mar...@python.net


On Fri, Mar 1, 2013, at 09:24 AM, Roy Smith wrote:
 In article 4fcc93b7-3be9-416f-a2d4-bdc6cba21...@googlegroups.com,
  Jaiky jaiprakashsingh...@gmail.com wrote:
 
 [a lot of code involving ssh and paramiko]
 
 Here's a few general suggestions:
 
 1) Try to reduce this to the smallest possible amount of code which 
 demonstrates the problem.  You gave us a page full of complicated stuff.  
 Keep hacking away lines of code that don't change the behavior until you 
 get it down to something small and understandable.
 
 2) Try to eliminate environmental problems.  You're running this under 
 django?  Does it work as a stand-alone process (i.e. without django)?


Also, what is the context (Is it running in a Django view; a model? a
signal handler? in settings?)?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Speeding up Python's exit

2013-03-01 Thread Antoine Pitrou
Steven D'Aprano steve+comp.lang.python at pearwood.info writes:
 
 I just quit an interactive session using Python 2.7 on Linux. It took in 
 excess of twelve minutes to exit, with the load average going well past 9 
 for much of that time.
 
 I think the reason it took so long was that Python was garbage-collecting 
 a giant dict with 10 million entries, each one containing a list of the 
 form [1, [2, 3], 4]. But still, that's terribly slow -- ironically, it 
 took longer to dispose of the dict (12+ minutes) than it took to create 
 it in the first place (approx 3 minutes, with a maximum load of 4). 
 
 Can anyone explain why this was so painfully slow, and what (if anything) 
 I can do to avoid it in the future?

You are basically asking people to guess where your performance problem
comes from, without even providing a snippet so that people can reproduce ;)

 I know there is a function os._exit which effectively kills the Python 
 interpreter dead immediately, without doing any cleanup. What are the 
 consequences of doing this? I assume that the memory used by the Python 
 process will be reclaimed by the operating system, but other resources 
 such as opened files may not be.

The OS always disposes of per-process resources when the process terminates
(except if the OS is buggy ;-)). However, file buffers will not be flushed,
atexit handlers and other destructors will not be called, database
transactions will be abandoned (rolled back), etc.

Regards

Antoine.


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


Best Practices with Python

2013-03-01 Thread Stephane Wirtel
Hi all,

How are you ? me ? fine ;-)

I have a lot of questions about the development with Python.

I want to discuss about the tools for the enhancement of the quality of
a project, not about the debugging (I don't want to discuss about pdb,
ipdb, pudb, ...)

I use these tools 

1. Documentation
sphinx: http://sphinx-doc.org/

a. I like the reStructuredText syntax
b. We can parse the files and get an AST
c. We can add a lot of directives or new roles for custom behaviors
d. We can generate several output formats (pdf, epub, html)

2. BDD
I use Behave: http://pythonhosted.org/behave/

3. TDD
unittest2
mock
nose

4. Code

Clone Digger ?
for me this project is very useful because we can determine the
duplicated code via a pattern matching.
but the project seems to be dead

pylint ?
very strict but we can change the configuration, but very useful
to have a quality of code

flake8 ?
more permissive than pylint.

5. Continuous Integration Server
Jenkins with Shining Panda

What do you think about Buildbot ?

6. Logging

And you, what are your best practices ?

Regards,

Stéphane

-- 
Stéphane Wirtel - http://wirtel.be - @matrixise
-- 
http://mail.python.org/mailman/listinfo/python-list


No symbol error using pystack gdb macro

2013-03-01 Thread debby
I'm relatively new to Python, running Python 3.3 on FreeBSD

I have a process which has started to spike CPU usage.  I'm trying to find out 
what it's doing.

I tried the pystack macro suggested here:

http://stackoverflow.com/questions/132058/showing-the-stack-trace-from-a-running-python-application/147114#147114

I got the gdbinit macro from:

http://svn.python.org/projects/python/trunk/Misc/gdbinit 

When I attach gdb, it tells me it is loading symbols from python3.3m

However when I run pystack I get:

No symbol PyStringObject in current context.

Do I need an updated version of the gdb macro for Python3.3?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Triple nested loop python (While loop insde of for loop inside of while loop)

2013-03-01 Thread Isaac Won
Thank you, Chris.
I just want to acculate value from y repeatedly.
If y = 1,2,3...10, just have a [1,2,3...10] at onece.
On Friday, March 1, 2013 7:41:05 AM UTC-6, Chris Angelico wrote:
 On Fri, Mar 1, 2013 at 7:59 PM, Isaac Won winef...@gmail.com wrote:
 
  while c 24:
 
  for columns in ( raw.strip().split() for raw in f ):
 
  while d 335:
 
 
 
 Note your indentation levels: the code does not agree with your
 
 subject line. The third loop is not actually inside your second.
 
 Should it be?
 
 
 
 ChrisA

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


Re: Triple nested loop python (While loop insde of for loop inside of while loop)

2013-03-01 Thread Isaac Won
On Friday, March 1, 2013 7:41:05 AM UTC-6, Chris Angelico wrote:
 On Fri, Mar 1, 2013 at 7:59 PM, Isaac Won winef...@gmail.com wrote:
 
  while c 24:
 
  for columns in ( raw.strip().split() for raw in f ):
 
  while d 335:
 
 
 
 Note your indentation levels: the code does not agree with your
 
 subject line. The third loop is not actually inside your second.
 
 Should it be?
 
 
 
 ChrisA

Yes, the thiird lood should be inside of my whole loop.
Thank you,
Isaac
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.system() not responding on django... any reason?

2013-03-01 Thread Jaiky
it is running in view.. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.system() not responding on django... any reason?

2013-03-01 Thread Jaiky
in django inviroment..
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Triple nested loop python (While loop insde of for loop inside of while loop)

2013-03-01 Thread Isaac Won
Thank you Ulich for reply,
What I really want to get from this code is m1 as I told. For this purpose, for 
instance, values of fpsd upto second loop and that from third loop should be 
same, but they are not. Actually it is my main question.
Thank you,
Isaac
On Friday, March 1, 2013 6:00:42 AM UTC-6, Ulrich Eckhardt wrote:
 Am 01.03.2013 09:59, schrieb Isaac Won:
 
  try to make my triple nested loop working. My code would be:
 
  c = 4
 
 [...]
 
  while c 24:
 
   c = c + 1
 
 
 
 This is bad style and you shouldn't do that in python. The question that 
 
 comes up for me is whether something else is modifying c in that loop, 
 
 but I think the answer is no. For that reason, use Python's way:
 
 
 
for c in range(5, 25):
 
...
 
 
 
 That way it is also clear that the first value in the loop is 5, while 
 
 the initial c = 4 seems to suggest something different. Also, the last 
 
 value is 24, not 23.
 
 
 
 
 
 
 
   while d 335:
 
   d = d + 1
 
   y = fpsd[d]
 
   y1 = y1 + [y]
 
  m = np.mean(y1)
 
   m1 = m1 + [m]
 
 
 
 Apart from the wrong indention (don't mix tabs and spaces, see PEP 8!) 
 
 and the that d in range(336) is better style, you don't start with an 
 
 empty y1, except on the first iteration of the outer loop.
 
 
 
 I'm not really sure if that answers your problem. In any case, please 
 
 drop everything not necessary to demostrate the problem before posting. 
 
 This makes it easier to see what is going wrong both for you and others. 
 
 Also make sure that others can actually run the code.
 
 
 
 
 
 Greetings from Hamburg!
 
 
 
 Uli

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


Re: Issue with continous incrementing of unbroken sequence for a entire working day

2013-03-01 Thread Morten Engvoldsen
Hi,
Yes, i think checking only date is sufficient . here is my code:

from datetime import date

def read_data_file():
with open(workfile.txt, 'r') as f:
for line in f.readlines():
read_data = line.split(' ')
return read_data

def write_data_file(data):
fo = open(workfile.txt, w)
fo.write(str(data))
fo.close()

def comput_date(read_date, now_time, read_serial):
if read_date == now_time:
read_serial = int(read_serial)
return read_serial + 1
else:
read_serial = 1
return read_serial

def process_sales_record():
now_time = time.strftime(%d-%m-%y)
readdata = read_data_file()
if readdata:
read_serial = readdata[0]
read_date = readdata[1]
copute_date = comput_date(read_date, now_time, read_serial)
serial_number = copute_date
print serial_number
sales_recrod = {'record1':'product1',
'record2':'product2','record3':'product3'}
for i in sales_recrod:
print sales_recrod[i]
serial_number += 1
print serial_number
data = str(serial_number) + ' ' + now_time
writedata = write_data_file(data)
print readdata

Can you give me suggestion how can i improve this code


-- Forwarded message --
From: MRAB pyt...@mrabarnett.plus.com
To: python-list@python.org
Cc:
Date: Fri, 01 Mar 2013 14:09:43 +
Subject: Re: Issue with continous incrementing of unbroken sequence
for a entire working day
On 2013-03-01 09:42, Morten Engvoldsen wrote:

Hi,
Thanks.. :)
so simply i can use time.strftime(%d%-m-%y  %H:%M)  , and then i can
compare the date

I think you're only interested in the date, not the time of day:

time.strftime(%d-%m-%y)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-01 Thread Chris Angelico
On Sat, Mar 2, 2013 at 3:55 AM, 김용빈 kyb...@gmail.com wrote:
 why we bother with '{variable}'.format(variable=variable) ?
 can we just '{variable}.format()' ?

 if variable is exist, then assign it.
 if variable is not exist, then raise error

 I am not language expert. so sorry if this is not a good idea, or already
 discussed.

You're asking for a facility whereby variables magically get pulled
from the caller's scope. Let me put it to you another way:

def func1():
   return foo +  world

def func2():
foo = Hello
print(func1 returns: +func1())

func2()

Will this work? If not, why not?

There are ways around this; you can, for instance, pass locals() to format():
'{variable}'.format(**locals())

But this is massive overkill and can unexpectedly expose a whole lot
more than you wanted (an issue if you accept a format string from an
untrusted source). Generally, it's best to be explicit. You can avoid
repeating the name so much by using positional parameters instead:

'{0}'.format(variable)

Of course, this has its own considerations. But at least it isn't magical. :)

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


tracer une cercle dans python tkinter?

2013-03-01 Thread olsr . kamal
comment tracer une cercle  contient un numéro au un symbole dans le center dans 
python tkinter?
-- 
http://mail.python.org/mailman/listinfo/python-list


Putting the loop inside of loop properly

2013-03-01 Thread Isaac Won
I just would like to make my previous question simpler and I bit adjusted my 
code with help with Ulich and Chris.
The basic structure of my code is:

for c in range(5,25):

for columns in ( raw.strip().split() for raw in f ):
a.append(columns[c])
x = np.array(a, float)
not_nan = np.logical_not(np.isnan(x))
indices = np.arange(len(x))
interp = interp1d(indices[not_nan], x[not_nan], kind = 'nearest')
p = interp(indices)


N = len(p)


fpsd = plot_freq*PSD
f.seek(0,0)
for d in range(336):

y = fpsd[d]
y1 = y1 + [y]
m = np.mean(y1)
m1 = m1 + [m]
--
I just removed seemingly unnecesary lines. I expect that last loop can produce 
the each order values (first, second, last(336th)) of fpsd from former loop.
fpsd would be 20 lists. So, fpsd[0] in third loop shoul be first values from 20 
lists and it expects to be accumulated to y1. So, y1 should be the list of 
first values from 20 fpsd lists. and m is mean of y1. I expect to repeat 356 
times and accumulated to m1. However, it doesn't work and fpsd values in and 
out of the last loop are totally different.
My question is clear?
Any help or questions would be really appreciated.
Isaac
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tracer une cercle dans python tkinter?

2013-03-01 Thread Vincent Vande Vyvre
Le 01/03/13 18:53, olsr.ka...@gmail.com a écrit :
 comment tracer une cercle  contient un numéro au un symbole dans le center 
 dans python tkinter?
Posez votre question ici:

http://www.developpez.net/forums/f96/autres-langages/python-zope/

-- 
Vincent V.V.
Oqapy https://launchpad.net/oqapy . Qarte
https://launchpad.net/qarte . PaQager https://launchpad.net/paqager
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tracer une cercle dans python tkinter?

2013-03-01 Thread Karim

On 01/03/2013 19:10, Vincent Vande Vyvre wrote:

Le 01/03/13 18:53, olsr.ka...@gmail.com a écrit :

comment tracer une cercle  contient un numéro au un symbole dans le center dans 
python tkinter?

Posez votre question ici:

http://www.developpez.net/forums/f96/autres-langages/python-zope/


Heuu en anglais vous toucherez plus de monde.

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


Re: Putting the loop inside of loop properly

2013-03-01 Thread MRAB

On 2013-03-01 18:07, Isaac Won wrote:

I just would like to make my previous question simpler and I bit adjusted my 
code with help with Ulich and Chris.
The basic structure of my code is:

for c in range(5,25):

 for columns in ( raw.strip().split() for raw in f ):

[snip]

When you're using .split() with no argument (split on any whitespace),
you don't need to use .strip() with no argument (strip any whitespace):

 ' foo  bar  '.strip().split()
['foo', 'bar']
 ' foo  bar  '.split()
['foo', 'bar']

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


Re: IMAP4_SSL and OpenSSL compatibility

2013-03-01 Thread Antoine Pitrou
W. Martin Borgert debacle at debian.org writes:
 
  There is already the ssl_context option for that:
  http://docs.python.org/3.3/library/imaplib.html#imaplib.IMAP4_SSL
 
 Many thanks! Two more questions:
 
   1. Is there any plan to backport this Python = 3.3 feature to
  Python 2?

No, we don't backport new features to maintenance releases.

   2. Would the following lines be correct for Python 3.3?
 
   import imaplib
   IMAP4_SSL(192.168.1.1., ssl_context =  
 SSLContext(ssl.PROTOCOL_SSLv3))

It should be, yes.

Regards

Antoine.


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


Re: tracer une cercle dans python tkinter?

2013-03-01 Thread Peter Otten
olsr.ka...@gmail.com wrote:

 comment tracer une cercle  contient un numéro au un symbole dans le center
 dans python tkinter?

[I hope you can cope with English]

Use a Canvas widget:

import tkinter as tk

root = tk.Tk()
canvas = tk.Canvas(root, width=240, height=240)
canvas.pack()

canvas.create_oval((20, 20), (220, 220), width=10, fill=white)
tag = canvas.create_text(120, 120, text=42, justify=tk.CENTER, 
font=(Helvetica, 110), fill=#800)

if 1: # fancy stuff; you can safely remove the complete if-statement

def n(x):
while True:
for i in reversed(range(x+1)):
yield i

values = n(42)
def down():
text = str(next(values))
canvas.itemconfig(tag, text=text)
root.after(300, down)

down()

root.mainloop()


See 

http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/canvas.html

for more.

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


Re: Speeding up Python's exit

2013-03-01 Thread Antoine Pitrou
Grant Edwards invalid at invalid.invalid writes:
 
  I assume that the memory used by the Python process will be reclaimed
  by the operating system, but other resources such as opened files may
  not be.
 
 All open files (including sockets, pipes, serial ports, etc) will be
 flushed (from an OS standpoint) and closed.

According to POSIX, no, open files will not be flushed:

“The _Exit() and _exit() functions shall not call functions registered with 
atexit() nor any registered signal handlers. Open streams shall not be flushed. 
Whether open streams are closed (without flushing) is implementation-defined.”

http://pubs.opengroup.org/onlinepubs/9699919799/functions/_exit.html

(under the hood, os._exit() calls C _exit())

Regards

Antoine.


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


Re: os.system() not responding on django... any reason?

2013-03-01 Thread Mark Lawrence

On 01/03/2013 16:23, Jaiky wrote:

it is running in view..



When replying can you please ensure we have the complete context, 
otherwise we have to spend time looking, thanks.


--
Cheers.

Mark Lawrence

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


Re: Speeding up Python's exit

2013-03-01 Thread Dave Angel

On 03/01/2013 02:10 PM, Antoine Pitrou wrote:

Grant Edwards invalid at invalid.invalid writes:

 snip
All open files (including sockets, pipes, serial ports, etc) will be
flushed (from an OS standpoint) and closed.


According to POSIX, no, open files will not be flushed:

“The _Exit() and _exit() functions shall not call functions registered with
atexit() nor any registered signal handlers. Open streams shall not be flushed.
Whether open streams are closed (without flushing) is implementation-defined.”



Note he didn't say the python buffers would be flushed.  It's the OS 
buffers that are flushed.



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


need for help

2013-03-01 Thread leonardo selmi
hi guys

i typed the following program:

class ball:
def _init_(self, color, size, direction):
self.color = color
self.size = size
self.direction = direction

def _str_(self):
msg = 'hi, i am a ' + self.size + ' ' + self.color + 'ball!'
return msg

myball = ball('red', 'small', 'down')
print my ball

BUT I GOT THIS ERROR:

Traceback (most recent call last):
  File /Users/leonardo/Documents/ball2.py, line 11, in module
myball = ball('red', 'small', 'down')
TypeError: this constructor takes no arguments

can you kindly tell me what is wrong?
thanks a lot!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: need for help

2013-03-01 Thread Rob Day
It looks like you're using single underscores, not double: the methods
should be __init__ and __str__.

On 1 March 2013 18:35, leonardo selmi l.se...@icloud.com wrote:
 hi guys

 i typed the following program:

 class ball:
 def _init_(self, color, size, direction):
 self.color = color
 self.size = size
 self.direction = direction

 def _str_(self):
 msg = 'hi, i am a ' + self.size + ' ' + self.color + 'ball!'
 return msg

 myball = ball('red', 'small', 'down')
 print my ball

 BUT I GOT THIS ERROR:

 Traceback (most recent call last):
   File /Users/leonardo/Documents/ball2.py, line 11, in module
 myball = ball('red', 'small', 'down')
 TypeError: this constructor takes no arguments

 can you kindly tell me what is wrong?
 thanks a lot!
 --
 http://mail.python.org/mailman/listinfo/python-list



--
Robert K. Day
robert@merton.oxon.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: need for help

2013-03-01 Thread Dave Angel

On 03/01/2013 01:35 PM, leonardo selmi wrote:

hi guys

i typed the following program:

class ball:
 def _init_(self, color, size, direction):
 self.color = color
 self.size = size
 self.direction = direction

 def _str_(self):
 msg = 'hi, i am a ' + self.size + ' ' + self.color + 'ball!'
 return msg

myball = ball('red', 'small', 'down')
print my ball

BUT I GOT THIS ERROR:

Traceback (most recent call last):
   File /Users/leonardo/Documents/ball2.py, line 11, in module
 myball = ball('red', 'small', 'down')
TypeError: this constructor takes no arguments

can you kindly tell me what is wrong?
thanks a lot!



1) please pick a useful subject line.  Every message needs help.  But 
yours might be something like constructor takes no arguments


2) please tell us Python version you're targeting.  I'm assuming 2.7

3) Thank you for giving a full traceback error message.  Much better 
than an image file, or just paraphrasing, as many do. And thanks for 
posting as a text message, so your formatting doesn't get trashed.


When I run the program, I get:

davea@think2:~/temppython$ python leonardo.py
  File leonardo.py, line 13
print my ball
^
SyntaxError: invalid syntax
davea@think2:~/temppython$


Which is caused by having a space in the middle of the myball variable.

After fixing that, I get your error, which is triggered by misspelling 
__init__(you omitted one of the underscores at each end).


After fixing that, I get

davea@think2:~/temppython$ python leonardo.py
__main__.ball instance at 0x7f330da5bbd8
davea@think2:~/temppython$

which is triggered by the same error in the __str__ method.  These 
special methods are sometimes called dunder methods, because they all 
need double underscores, at both front and back.


davea@think2:~/temppython$ python leonardo.py
hi, i am a small redball!
davea@think2:~/temppython$


The other thing you should fix is the class definition line.  You forgot 
to derive your class from object, which makes your class an old style 
one, deprecated for many many years.  Doesn't matter here, but sooner or 
later it will.  And Python 3 supports only new-style classes, so you 
might as well be using them.


class ball(object):#new style class


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


Re: QT Inspired web development framework for python

2013-03-01 Thread timothy crosley
Hi Michael,

Thanks! Since it simply produces html it can integrate very cleanly with 
django, or
Any other framework that allows returning raw html. To be more specific,  in 
django withing a view function you can return a response object that contains 
the HTML produced by WebElements. In the future I plan on adding even more 
django integration 
For things such as ajax abstraction. The long term vision is to be able to 
create apps and widgets that will run on any python framework unmodified except 
for calls to the database etc.

Timothy

Thursday, February 28, 2013 11:43:04 PM UTC-5, Michael Torrie wrote:
 On 02/28/2013 06:48 PM, timothy crosley wrote:
 
  I've been working on a web development framework that integrates several 
  popular QT features (such as a graphical template builder, signal / slots, 
  ui's built by objects) for the last few years, and I was hoping that some 
  people here might find it useful.
 
  
 
  If you are interested the main link for the widgets is 
  http://www.webelements.in
 
  and the link for the framework overall is http://www.webbot.ws
 
 
 
 Very professional-looking pages, I must say!
 
 
 
 How would your framework fit into a framework such as Django? In other
 
 words, could it be used as the view part of django?  Or is it meant to
 
 completely replace a traditional web framework?

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


Re: QT Inspired web development framework for python

2013-03-01 Thread Ian Kelly
On Fri, Mar 1, 2013 at 1:02 PM, timothy crosley
timothy.cros...@gmail.com wrote:
 Thanks! Since it simply produces html it can integrate very cleanly with 
 django, or
 Any other framework that allows returning raw html. To be more specific,  in 
 django withing a view function you can return a response object that contains 
 the HTML produced by WebElements. In the future I plan on adding even more 
 django integration

Is the intention here that the Django view would invoke WebElements at
run-time to generate the HTML, or might one use WebElements to
pre-compile HTML and JS, which could then be processed through
Django's template engine?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: QT Inspired web development framework for python

2013-03-01 Thread timothy crosley
Hi Ian,

The intention would be to invoke WebElements at view run time, this way the 
developer can write code to  interact with the elements and effect the produced 
HTML dynamically on every request

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


comment tracer des neoudspar Click

2013-03-01 Thread olsr . kamal
comment tracer des neouds aprés Click sur un canvas par un buttoun tkinter qui 
prendre les coordonnées et tracer un neoud?
-- 
http://mail.python.org/mailman/listinfo/python-list


book advice

2013-03-01 Thread leonardo selmi
hi

is there anyone can suggest me a good book to learn python? i read many but 
there is always something unclear or examples which give me errors.
how can I start building a sound educational background

thanks for any help 

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


Re: book advice

2013-03-01 Thread Joel Goldstick
On Fri, Mar 1, 2013 at 3:59 PM, leonardo selmi l.se...@icloud.com wrote:

 hi

 is there anyone can suggest me a good book to learn python? i read many
 but there is always something unclear or examples which give me errors.
 how can I start building a sound educational background


start here:  http://www.python.org/doc/

There are lots of links for different levels and learning styles.  Keep at
it.  Move from tutorial when you get too stuck.


 thanks for any help

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




-- 
Joel Goldstick
http://joelgoldstick.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: need for help

2013-03-01 Thread Alister
On Fri, 01 Mar 2013 19:35:14 +0100, leonardo selmi wrote:

 hi guys
 
 i typed the following program:
 
 class ball:
 def _init_(self, color, size, direction):
 self.color = color self.size = size self.direction = direction
 
 def _str_(self):
 msg = 'hi, i am a ' + self.size + ' ' + self.color + 'ball!'
 return msg
 
 myball = ball('red', 'small', 'down')
 print my ball
 
 BUT I GOT THIS ERROR:
 
 Traceback (most recent call last):
   File /Users/leonardo/Documents/ball2.py, line 11, in module
 myball = ball('red', 'small', 'down')
 TypeError: this constructor takes no arguments
 
 can you kindly tell me what is wrong?
 thanks a lot!

as far as I can see is_init_ should be __init__ (double underscore)



-- 
The autodecrement is not magical.
 -- Larry Wall in the perl man page
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: book advice

2013-03-01 Thread Matty Sarro
Google learn python the hard way by Zed A. Shaw. It's free and fantastic.

Read it, and once you're done read The Pragmatic Programmer 
On Mar 1, 2013 4:04 PM, leonardo selmi l.se...@icloud.com wrote:

 hi

 is there anyone can suggest me a good book to learn python? i read many
 but there is always something unclear or examples which give me errors.
 how can I start building a sound educational background

 thanks for any help

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

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


ANN: pathlib 0.8

2013-03-01 Thread Antoine Pitrou

pathlib 0.8 has been released at https://pypi.python.org/pypi/pathlib/


Changes
---

- Add PurePath.name and PurePath.anchor.
- Add Path.owner and Path.group.
- Add Path.replace().
- Add Path.as_uri().
- Issue #10: when creating a file with Path.open(), don't set the executable
  bit.
- Issue #11: fix comparisons with non-Path objects.

What is pathlib?


pathlib offers a set of classes to handle filesystem paths.  It offers the
following advantages over using string objects:

* No more cumbersome use of os and os.path functions.  Everything can be
  done easily through operators, attribute accesses, and method calls.

* Embodies the semantics of different path types.  For example, comparing
  Windows paths ignores casing.

* Well-defined semantics, eliminating any warts or ambiguities (forward vs.
  backward slashes, etc.).

Requirements


Python 3.2 or later is recommended, but pathlib is also usable with Python 2.7.


Documentation
-

The full documentation can be read at `Read the Docs
http://readthedocs.org/docs/pathlib/en/latest/`_.


Contributing


The issue tracker and repository are hosted by `BitBucket
https://bitbucket.org/pitrou/pathlib/`_.


Regards

Antoine.


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


Re: Speeding up Python's exit

2013-03-01 Thread Antoine Pitrou
Dave Angel davea at davea.name writes:
 
 Note he didn't say the python buffers would be flushed.  It's the OS 
 buffers that are flushed.

Now please read my message again. The OS buffers are *not* flushed according
to POSIX.



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


Re: need for help

2013-03-01 Thread Rick Johnson
On Friday, March 1, 2013 12:35:14 PM UTC-6, leonardo selmi wrote:
 class ball:
 
 [...]
 

Now that you've gotten the exceptions sorted, it may be time to join the 
*other* 99% of programmers by editing that class identifier. All class symbols 
should start with (at minimum) a capitol letter.

After you do that, you should start reading and adapting as much of the Python 
style guide you can handle.

  http://www.python.org/dev/peps/pep-0008/

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


Best way to convert number of minutes to hh:mm AM/PM?

2013-03-01 Thread andydtaylor
Hi,

I need to create a list of equally spaced times (as in hh:mm AM/PM) within a 
day to loop through. Having selected 30 minute intervals I figured I could:

* Create a list from 1 to 48
* Multiply each value by 30
* Convert minutes to a time. datetime.timedelta seems to do this, but it's not 
a full timestamp which means strftime can't format me a time with am/pm.

can anyone suggest a good approach to use? Ultimately I'd like to generate an 
equivalent to this text/format:'2:30 pm'

Thanks,


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


Re: Best way to convert number of minutes to hh:mm AM/PM?

2013-03-01 Thread MRAB

On 2013-03-02 00:12, andydtay...@gmail.com wrote:

Hi,

I need to create a list of equally spaced times (as in hh:mm AM/PM) within a 
day to loop through. Having selected 30 minute intervals I figured I could:

* Create a list from 1 to 48
* Multiply each value by 30
* Convert minutes to a time. datetime.timedelta seems to do this, but it's not 
a full timestamp which means strftime can't format me a time with am/pm.

can anyone suggest a good approach to use? Ultimately I'd like to generate an 
equivalent to this text/format:'2:30 pm'

You can still use strftime, just pick a day but don't include it in the 
format.


You can make the list like this:

[(datetime.datetime(2000, 1, 1) + datetime.timedelta(minutes=30) * 
i).strftime(%H:%M%p) for i in range(48)]


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


Re: Best way to convert number of minutes to hh:mm AM/PM?

2013-03-01 Thread Vlastimil Brom
2013/3/2  andydtay...@gmail.com:
 Hi,

 I need to create a list of equally spaced times (as in hh:mm AM/PM) within a 
 day to loop through. Having selected 30 minute intervals I figured I could:

 * Create a list from 1 to 48
 * Multiply each value by 30
 * Convert minutes to a time. datetime.timedelta seems to do this, but it's 
 not a full timestamp which means strftime can't format me a time with am/pm.

 can anyone suggest a good approach to use? Ultimately I'd like to generate an 
 equivalent to this text/format:'2:30 pm'

 Thanks,


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

Hi,
you may use e.g. gmtime and only take the hours and minutes part into
account; the drawback is the range calculation in seconds:

 [time.strftime(%I:%M%p, time.gmtime(s)) for s in range(0, 86401, 1800)]
['12:00AM', '12:30AM', '01:00AM', '01:30AM', '02:00AM', '02:30AM',
'03:00AM', '03:30AM', '04:00AM', '04:30AM', '05:00AM', '05:30AM',
'06:00AM', '06:30AM', '07:00AM', '07:30AM', '08:00AM', '08:30AM',
'09:00AM', '09:30AM', '10:00AM', '10:30AM', '11:00AM', '11:30AM',
'12:00PM', '12:30PM', '01:00PM', '01:30PM', '02:00PM', '02:30PM',
'03:00PM', '03:30PM', '04:00PM', '04:30PM', '05:00PM', '05:30PM',
'06:00PM', '06:30PM', '07:00PM', '07:30PM', '08:00PM', '08:30PM',
'09:00PM', '09:30PM', '10:00PM', '10:30PM', '11:00PM', '11:30PM',
'12:00AM']


regards,
 vbr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to convert number of minutes to hh:mm AM/PM?

2013-03-01 Thread Cameron Simpson
On 01Mar2013 16:12, andydtay...@gmail.com andydtay...@gmail.com wrote:
| I need to create a list of equally spaced times (as in hh:mm
| AM/PM) within a day to loop through. Having selected 30 minute
| intervals I figured I could:
| 
| * Create a list from 1 to 48
| * Multiply each value by 30
| * Convert minutes to a time. datetime.timedelta seems to do this,
|   but it's not a full timestamp which means strftime can't format me
|   a time with am/pm.
| 
| can anyone suggest a good approach to use? Ultimately I'd like
| to generate an equivalent to this text/format:'2:30 pm'

If they're just minutes to hours and minutes you don't need datetime;
it is most useful to handle the many complexities of calendars.

There are 60 minutes to an hour. So something like (untested):

  for n in range(0,48): # counts 0..47 inclusive
minutes = 30 * (n + 1)
hours = minutes // 60
minutes = minutes % 60
if hours = 12:
  ampm = 'pm'
  hours -= 12
else:
  ampm = 'am'
if hours  1:
  hours += 12
print '%02d:%02d %s % (hours, minutes, ampm)

Cheers,
-- 
Cameron Simpson c...@zip.com.au

The Borg assimilated my race and all I got was this lousy tagline.
- Cath Lawrence cath_lawre...@premium.com.au
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-01 Thread Steven D'Aprano
On Sat, 02 Mar 2013 04:07:19 +1100, Chris Angelico replied to a thread of 
Python-ideas:

 You're asking for a facility whereby variables magically get pulled from
 the caller's scope.

As interesting as that is, I think you sent it to the wrong list :)

Again.

O_o


No offence Chris, but you're the only person I know who *regularly* 
replies to the wrong list. Does your mail client not have a Reply to 
List command, or Reply All? If so, then you should use it rather than 
manually typing the (wrong) list address in.



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


Re: Store a variable permanently

2013-03-01 Thread Steven D'Aprano
On Fri, 01 Mar 2013 07:42:38 -0700, Michael Torrie wrote:

 Another solution is to use a database system.  Either SQLite
 (file-based) or something server-based like PosgreSQL or MariaDB.

The data in this case is a single integer value. Installing and running a 
database for a single integer is like using a using a bulldozer for 
moving your keyboard half an inch to the left.



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


Re: Why is it impossible to create a compiler than can compile Python to machinecode like C?

2013-03-01 Thread Steven D'Aprano
On Fri, 01 Mar 2013 08:48:34 +0100, Stefan Behnel wrote:

 Steven D'Aprano, 01.03.2013 04:47:
 On Thu, 28 Feb 2013 22:03:09 +0100, Stefan Behnel wrote:
 
 The most widely used static Python compiler is Cython
 
 Cython is not a Python compiler. Cython code will not run in a vanilla
 Python implementation. It has different keywords and syntax, e.g.:
 
 cdef inline int func(double num):
 ...
 
 which gives SyntaxError in a Python compiler.
 
 Including Cython, if you're compiling a .py file. The above is only
 valid syntax in .pyx files. Two languages, one compiler. Or three
 languages, if you want, because Cython supports both Python 2 and Python
 3 code in separate compilation modes.


Ah, that's very interesting, and thank you for the correction. I have re-
set my thinking about Cython.



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


Re: Store a variable permanently

2013-03-01 Thread Modulok
 Installing and running a database for a single integer is like using a
 using a bulldozer for moving your keyboard half an inch to the left.

I'd like to see that sometime XD

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


Re: Store a variable permanently

2013-03-01 Thread Roy Smith
In article 51315957$0$30001$c3e8da3$54964...@news.astraweb.com,
 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:

 On Fri, 01 Mar 2013 07:42:38 -0700, Michael Torrie wrote:
 
  Another solution is to use a database system.  Either SQLite
  (file-based) or something server-based like PosgreSQL or MariaDB.
 
 The data in this case is a single integer value. Installing and running a 
 database for a single integer is like using a using a bulldozer for 
 moving your keyboard half an inch to the left.

True, but it's worth pointing out that SQLite is such a small bulldozer 
that it could fit in your shirt pocket with room left over for a couple 
of pencils.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Store a variable permanently

2013-03-01 Thread Steven D'Aprano
On Fri, 01 Mar 2013 11:19:22 +0100, Jean-Michel Pichavant wrote:

 - Original Message -
 So i have a variable called funds that i want to store the value of
 even after the program is exited. My funds variable holds the total
 value of funds i have. I add a certain number of funds each time i run
 the program by entering how much i want to add. How would i store the
 funds variable to keep its value? --
 http://mail.python.org/mailman/listinfo/python-list
 
 
 Hi,
 
 I would serialize the data.
 
 http://docs.python.org/2/library/pickle.html


I don't think we should recommend to a newbie that they use pickle 
without even warning them that using pickle is insecure and dangerous if 
they are opening pickles from untrusted sources.

But for a single int, pickle too is overkill, and a simple human-readable 
and writable file is probably all that is needed:

def save_value(n, configfile='myconfig'):
if n != int(n):
raise ValueError('expected an int')
with open(configfile, 'w') as f:
f.write(value=%d % n)

def load_value(configfile='myconfig'):
with open(configfile) as f:
s = f.read().strip()
a, b = s.split(=, 1)
if a.strip() != value:
raise ValueError('invalid config file')
return int(b)


Untested but ought to work.


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


Re: Speeding up Python's exit

2013-03-01 Thread Jason Swails
On Fri, Mar 1, 2013 at 5:51 PM, Antoine Pitrou solip...@pitrou.net wrote:

 Dave Angel davea at davea.name writes:
 
  Note he didn't say the python buffers would be flushed.  It's the OS
  buffers that are flushed.

 Now please read my message again. The OS buffers are *not* flushed
 according
 to POSIX.


I have observed this behavior on some Linux systems with a Fortran program
that terminated abnormally (via a kill signal).  Other Linux systems I've
used appear to flush their file buffers to disk in the event of a kill
signal, it really depends on the system.

If a file object's destructor is not called when the Python interpreter
exits and it's up to the OS to flush the file buffers to disk, you can't be
sure that it will do so.  And as Antoine pointed out, POSIX standard
doesn't require that they do.

All the best,
Jason
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: book advice

2013-03-01 Thread Dave Angel

On 03/01/2013 03:59 PM, leonardo selmi wrote:

hi

is there anyone can suggest me a good book to learn python? i read many but 
there is always something unclear or examples which give me errors.
how can I start building a sound educational background

thanks for any help

best regards



The question isn't even clear.  You should explain that Python is your 
first programming language, and you should also tell us what version of 
Python you're trying to use, and on what OS.  Your first tutorial MUST 
be oriented to match both of these, or you're going to have too much 
trouble with compatibilities to learn much.


Say you're using a particular tutorial, and you have successfully done 
each of the samples, and understand how they worked.


If you then come across a sample which gives you errors, why not post 
them here, and ask for help.  As often as not, it's a typo when you 
copied the example, or it's a version mismatch.


Likewise, if you then find something that's unclear, there are really 
only three possibilities:  1) the author blew it, either by poor 
explanation or by using concepts not previously explained properly  2) 
you didn't understand one of the earlier concepts, or 3) you're going at 
too fast a pace for your abilities.  (That's not a knock on your 
abilities, we all run at a different pace while first learning than we 
do when we're acclimated to a topic)


When I come across unclear explanation, and I want to understand it, I 
stop after a couple of passes through the explanation, and try some 
stuff.  Either the exercises in the same tutorial, or just some related 
things that let me get a handle on things.  Once I can express the 
unclarity in a small sample program, it's the perfect time to post it 
here, and ask why it works the way it does (or doesn't).


If you stick to common parts of the standard library, you'll probably 
find the tu...@python.org mailing list to be easier to get help at.  I 
read both, and respond where I can.


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


Re: Having problems crashing IDLE

2013-03-01 Thread Quintessence
Thank you for the advice! I checked the setting you specified and Open Shell 
Window at startup was already selected. Is there another bug this could be 
related to?

Thank you!

On Friday, March 1, 2013 3:00:40 AM UTC-5, Peter Otten wrote:
 Quintessence wrote:
 
 
 
  I've been learning Python over the past week or so and I keep running into
 
  an issue where opening saved files will crash IDLE (not consistently,
 
  sometimes the same files with no changes will open and sometimes not). I
 
  was originally running Python 3.2.3, but I removed it and upgraded to
 
  3.3.0 hoping to resolve the issue (but to no avail). While
 
  troubleshooting, someone suggested I try opening IDLE via command prompt.
 
  When I do that IDLE never crashes, but It does show this error
 
  (screenshot): http://i.imgur.com/1JqiRsY.png (3.2.3)
 
  http://i.imgur.com/5KxE88K.png (3.3.0)
 
 
 
 Your posts are easier to deal with if you provide tracebacks as text. 
 
 Here's what I get:
 
 
 
 Exception in Tkinter callback
 
 Traceback (most recent call last):
 
   File /usr/local/lib/python3.3/tkinter/__init__.py, line 1442, in 
 
 __call__
 
 return self.func(*args)
 
   File /usr/local/lib/python3.3/idlelib/MultiCall.py, line 174, in handler
 
 doafterhandler.pop()()
 
   File /usr/local/lib/python3.3/idlelib/MultiCall.py, line 221, in 
 
 lambda
 
 doit = lambda: self.bindedfuncs[triplet[2]][triplet[0]].remove(func)
 
 ValueError: list.remove(x): x not in list
 
 
 
  Some additional info:
 
  - When IDLE crashes it does not display an error, every open window simply
 
  closes. - IDLE has never crashed after opening a file when I open it via
 
  command prompt, even if it was previously consistently displaying that
 
  behavior. - I am running Windows 7 x64 with all updates.
 
  
 
  Has anyone ever encountered this? What does the error mean?
 
 
 
 This looks like the following bug:
 
 
 
 http://bugs.python.org/issue8900
 
 
 
 You might be able to work around it by selecting the
 
 
 
 At Startup Open Shell Window option under
 
 
 
 Options--Configure IDLE--General--Startup Preferences
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-01 Thread Chris Angelico
On Sat, Mar 2, 2013 at 12:43 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 On Sat, 02 Mar 2013 04:07:19 +1100, Chris Angelico replied to a thread of
 Python-ideas:

 You're asking for a facility whereby variables magically get pulled from
 the caller's scope.

 As interesting as that is, I think you sent it to the wrong list :)

Yes, as was pointed out to me privately.

The message had the feel of something that belonged on python-list,
and I never for a moment thought that it was an -ideas thread...

 Again.

 O_o


 No offence Chris, but you're the only person I know who *regularly*
 replies to the wrong list. Does your mail client not have a Reply to
 List command, or Reply All? If so, then you should use it rather than
 manually typing the (wrong) list address in.

Correct, Gmail doesn't. I should switch to Thunderbird (or something
else, but I've heard a good many recommendations for Tbird) but have
yet to get around to setting it up.

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


Re: [Python-ideas] string.format() default variable assignment

2013-03-01 Thread Devin Jeanpierre
On Fri, Mar 1, 2013 at 10:54 PM, Chris Angelico ros...@gmail.com wrote:
 No offence Chris, but you're the only person I know who *regularly*
 replies to the wrong list. Does your mail client not have a Reply to
 List command, or Reply All? If so, then you should use it rather than
 manually typing the (wrong) list address in.

 Correct, Gmail doesn't. I should switch to Thunderbird (or something
 else, but I've heard a good many recommendations for Tbird) but have
 yet to get around to setting it up.

Actually, it has a few ways to reply-to-all. In this screenshot, there
are three things I could click to reply-to-all:
http://imgur.com/914BNuY

First, I could click the big reply button. I changed a setting so that
reply-to-all is the default (Settings-General-Default reply
behavior). Second, there is the reply-to-all menu item in the reply
dropdown. Finally, in the textbox at the bottom, there's the
reply-to-all hyperlink.

It sounds like changing the default would do you the most good. It
usually does what I want.

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


How to install development package on linux?

2013-03-01 Thread Sarbjit singh
Sorry for this basic question but I am having problem compiling mod_wsgi on 
Linux. As per mod_wsgi package site, user must have python development package 
installed on system.

I had installed Python2.7 on my Linux system from source code, using the 
following configuration few months back :-

./configure –prefix=path --enable-shared
Make –i install

But I am not able to find how to install development package from source code. 

Can some one please conform if I can install the development package from the 
same source code (Downloaded from Python Website for Unix) and please share the 
configuration switch for the same.

Thanks,
Sarbjit
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-01 Thread Chris Angelico
On Sat, Mar 2, 2013 at 5:09 PM, Devin Jeanpierre jeanpierr...@gmail.com wrote:
 On Fri, Mar 1, 2013 at 10:54 PM, Chris Angelico ros...@gmail.com wrote:
 No offence Chris, but you're the only person I know who *regularly*
 replies to the wrong list. Does your mail client not have a Reply to
 List command, or Reply All? If so, then you should use it rather than
 manually typing the (wrong) list address in.

 Correct, Gmail doesn't. I should switch to Thunderbird (or something
 else, but I've heard a good many recommendations for Tbird) but have
 yet to get around to setting it up.

 Actually, it has a few ways to reply-to-all. In this screenshot, there
 are three things I could click to reply-to-all:
 http://imgur.com/914BNuY

Yes, but reply-all sends a copy to the poster as well as the list.
What I want is reply-list, acknowledging the list headers... and Gmail
simply doesn't have that.

I also want to be able to change my mind as to whether it's
reply-all/reply-list/reply-sender after typing up a reply. Guess it's
time I grabbed Tbird to find out if it can do that...

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


Re: No symbol error using pystack gdb macro

2013-03-01 Thread dieter
de...@josesmex.com writes:

 I'm relatively new to Python, running Python 3.3 on FreeBSD

 I have a process which has started to spike CPU usage.  I'm trying to find 
 out what it's doing.

 I tried the pystack macro suggested here:

 http://stackoverflow.com/questions/132058/showing-the-stack-trace-from-a-running-python-application/147114#147114

 I got the gdbinit macro from:

 http://svn.python.org/projects/python/trunk/Misc/gdbinit 

 When I attach gdb, it tells me it is loading symbols from python3.3m

 However when I run pystack I get:

 No symbol PyStringObject in current context.

 Do I need an updated version of the gdb macro for Python3.3?

Many system installed Python versions (all, I have seen so far)
are stripped, i.e. they lack debugging information.
Such information is necessary in order to use the gdb macros
effectively.

I suggest you install and compile your Python yourself.
Likely, the generated Python will have debugging symbols without
(manual) intervention. If not, the installation instructions should
tell you how to get a Python with debugging symbols.

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


Vodafone Smart review

2013-03-01 Thread 23alagmy
Vodafone Smart review

http://natigtas7ab.blogspot.com/2012/10/vodafone-smart-review.html
-- 
http://mail.python.org/mailman/listinfo/python-list


LG Optimus Black review

2013-03-01 Thread 23alagmy
LG Optimus Black review

http://natigtas7ab.blogspot.com/2012/10/lg-optimus-black-review.html
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue17323] Disable [X refs, Y blocks] ouput in debug builds

2013-03-01 Thread Ezio Melotti

New submission from Ezio Melotti:

I suggest to disable the [X refs, Y blocks] ouput in debug builds by default, 
and provide an option to enable it if/when necessary.
Most of the time these values are not necessary, and they end up getting in the 
way while copy/pasting code from the interpreter and/or running tests (we even 
have a function in test.support to get rid of them).
They are sometimes useful while investigating refleaks, so there should still 
be an option to enable it.  I'm not sure what would be the best way to do it (a 
new python flag?).

--
components: Interpreter Core
messages: 183244
nosy: ezio.melotti
priority: normal
severity: normal
stage: needs patch
status: open
title: Disable [X refs, Y blocks] ouput in debug builds
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17323
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11955] 3.3 : test_argparse.py fails 'make test'

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

The attached patch adds the list of args to the output of assertRaises in case 
of error, e.g.:
FAIL: test_failures_one_group_sysargs 
(test.test_argparse.TestPositionalsNargsZeroOrMoreNone)
--
Traceback (most recent call last):
  File /home/wolf/dev/py/3.3/Lib/test/test_argparse.py, line 216, in wrapper
test_func(self)
  File /home/wolf/dev/py/3.3/Lib/test/test_argparse.py, line 236, in 
test_failures
parser.parse_args(args)
AssertionError: ArgumentParserError not raised : ['foo', 'bar']

--
keywords: +patch
nosy: +ezio.melotti
stage:  - patch review
versions: +Python 3.4
Added file: http://bugs.python.org/file29280/issue11955.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11955
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14468] Update cloning guidelines in devguide

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

Yes, it should be added back in the FAQs.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14468
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17324] SimpleHTTPServer serves files even if the URL has a trailing slash

2013-03-01 Thread Larry Hastings

New submission from Larry Hastings:

To reproduce:

1) Create a file called foo.txt in the local directory, put whatever you like 
in it.
2) Run python -m SimpleHTTPServer or python3 -m http.server.
3) Point your web browser at http://127.0.0.1:8000/foo.txt/;.
4) Note that the server has served the contents of foo.txt as foo.txt/.  It 
shouldn't do that!

Reproduced with 2.7.3, 3.2.3, and 3.3.0.  I assume it's still there in trunk.

--
components: Library (Lib)
keywords: easy
messages: 183247
nosy: larry
priority: low
severity: normal
status: open
title: SimpleHTTPServer serves files even if the URL has a trailing slash
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17324
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17324] SimpleHTTPServer serves files even if the URL has a trailing slash

2013-03-01 Thread Larry Hastings

Changes by Larry Hastings la...@hastings.org:


--
stage:  - test needed
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17324
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17079] Fix test discovery for test_ctypes.py

2013-03-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 42d4a29509c4 by Ezio Melotti in branch '3.3':
#17079: test_ctypes now works with unittest test discovery.  Patch by Zachary 
Ware.
http://hg.python.org/cpython/rev/42d4a29509c4

New changeset e222f24837dd by Ezio Melotti in branch 'default':
#17079: merge with 3.3.
http://hg.python.org/cpython/rev/e222f24837dd

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17079
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17079] Fix test discovery for test_ctypes.py

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!

--
assignee:  - ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17079
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17082] Fix test discovery for test_dbm*.py

2013-03-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b62317fe1a22 by Ezio Melotti in branch '3.3':
#17082: test_dbm* now work with unittest test discovery.  Patch by Zachary Ware.
http://hg.python.org/cpython/rev/b62317fe1a22

New changeset e35c053cc4ec by Ezio Melotti in branch 'default':
#17082: merge with 3.3.
http://hg.python.org/cpython/rev/e35c053cc4ec

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17082
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17082] Fix test discovery for test_dbm*.py

2013-03-01 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!
There are still two failures, but they will be addressed in #16935.

--
assignee:  - ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17082
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17325] improve organization of the PyPI distutils docs

2013-03-01 Thread Chris Jerdonek

New submission from Chris Jerdonek:

This issue is to improve the organization of the PyPI section of the Distutils 
documentation, now that the information has been combined into one page.

A patch is attached.

Improvements include:

(1) Creating a section for command options common to both register and upload.  
Previously, this information was confined to the upload section, even though 
the information was applicable to both commands.
(2) Separating general information about PyPI (e.g. PyPI user permissions and 
the web interface) from the information about Distutils command usage.
(3) Consolidating information about the .pypirc file in the .pypirc section.  
Previously, some of the .pypirc information was spread throughout the upload 
section, even though the information is equally applicable to the register 
command.

--
assignee: eric.araujo
components: Distutils, Documentation
files: issue-pypi-docs.patch
keywords: patch
messages: 183252
nosy: chris.jerdonek, eric.araujo, tarek
priority: normal
severity: normal
stage: patch review
status: open
title: improve organization of the PyPI distutils docs
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29281/issue-pypi-docs.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17325
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17323] Disable [X refs, Y blocks] ouput in debug builds

2013-03-01 Thread Chris Jerdonek

Chris Jerdonek added the comment:

The refs output also complicates testing in some cases, e.g.

http://hg.python.org/cpython/file/bc4458493024/Lib/test/test_subprocess.py#l61
http://hg.python.org/cpython/file/bc4458493024/Lib/test/test_subprocess.py#l786

--
nosy: +chris.jerdonek

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17323
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17288] cannot jump from a return after setting f_lineno

2013-03-01 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Nosying Benjamin Peterson who knows frame_setlineno (issue 14612) and nosying
Jesús Cea Avión. Hoping they don't mind.

This problem occurs also when setting f_lineno from an exception debug event.

One may crash the interpreter (or get a SystemError: unknown opcode) when the
return debug event is one that handles a yield statement.  For example the
following test causes a segmentation fault on python 3.3.0:

$ python /tmp/jump.py
 /tmp/jump.py(7)module()
- for i in gen():
(Pdb) step
--Call--
 /tmp/jump.py(1)gen()
- def gen():
(Pdb) step
 /tmp/jump.py(2)gen()
- for i in range(1):
(Pdb) step
 /tmp/jump.py(3)gen()
- yield i
(Pdb) step
--Return--
 /tmp/jump.py(3)gen()-0
- yield i
(Pdb) jump 2
 /tmp/jump.py(2)gen()-0
- for i in range(1):
(Pdb) step
 /tmp/jump.py(8)module()
- lineno = 8
(Pdb) step
 /tmp/jump.py(7)module()
- for i in gen():
(Pdb) step
--Call--
 /tmp/jump.py(2)gen()-0
- for i in range(1):
(Pdb) step
Segmentation fault

--
nosy: +benjamin.peterson, jcea
Added file: http://bugs.python.org/file29282/jump.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17288
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17288] cannot jump from a return after setting f_lineno

2013-03-01 Thread Xavier de Gaye

Xavier de Gaye added the comment:

The proposed patch fixes the problem:
* f_lineno cannot be set now from an exception trace function or from a return
  trace function.
* The broken arithmetic involving a null pointer (f-f_stacktop, at the end of
  frame_setlineno when popping blocks that are being jumped from and the
  function is invoked from an exception trace function or a return trace
  function), is fixed now.
* Blocks cannot be popped now in frame_setlineno (the cause of the crash) when
  tracing a yield.

To summarize the proposed fixes on f_lineno accessors:
* setter: f_lineno can only be set in the frame that is being traced (issue
  17277) and from within a line trace function (current issue).
* getter: f_lineno is valid in the frame being traced (issue 17277) and:
  + not from within a call trace function (i.e. when f-f_trace == NULL)
  + from within a line trace function
  + and from within an exception or return trace function. There is a corner
case here when returning to a frame that was not being traced previously
(its f_lineno is not valid) and that has had its local trace function
f_trace set from within a trace function in one of its callees (the fix of
issue 13183 does that) and when the first trace function invoked on
returning to that frame is an exception or a return trace function: this is
correctly handled by the f_trace setter that makes sure that f_lineno is
accurate when setting f_trace (and an extension module implementing tracing,
must ensure that f_lineno is accurate when setting f_trace).

--
keywords: +patch
Added file: http://bugs.python.org/file29283/default.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17288
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >