Pogo 0.8.1

2013-01-21 Thread Jendrik Seipp

A new Pogo version has been released.

The tarball and an Ubuntu PPA are available at http://launchpad.net/pogo


What is Pogo?
-
Pogo plays your music. Nothing else. It is both fast and easy-to-use.
The clear interface uses the screen real-estate very efficiently.
Other features include: Fast search on the harddrive and in the 
playlist, smart album grouping, cover display, desktop notifications and 
NO music library.
Pogo is a fork of Decibel Audio Player and supports most common audio 
formats. It is written in Python and uses GTK+ and gstreamer.



What's new in this version?
---
* Support Pillow in addition to PIL.
* Disable zeitgeist module to avoid startup errors on Ubuntu 12.10.


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

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


Re: Else statement executing when it shouldnt

2013-01-21 Thread Steven D'Aprano
On Sun, 20 Jan 2013 22:00:10 -0800, alex23 wrote:

 On Jan 21, 2:54 pm, eli m techgeek...@gmail.com wrote:
 hint: Use the comments in the code to find out where my error is.
 
 Pro-tip: when people you're asking for help tell you how you can make it
 easier for them to help you, a snide response isn't the correct
 approach.

Alex, thank you for saying this. I can now delete my *much* less polite 
version saying the same thing.




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


Re: ANN: Python training text movies

2013-01-21 Thread Franck Ditter
Ok I can make my way with jstmovie. Some remarks and questions :

- Use encoding='utf-8' inside open of method __init__ of class Tutorial 
  in jstmovie.py. Otherwise foreign languages are stuck.

- To use the software outside Python, we need to have proper indentation
  as real spaces. We should be able to distinguish Arial type for usual
  text and fixed font for code.

- Should have some colors.

  Wadda wadda byadda/b # blue annotation

Cool and useful software,

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


Re: ANN: Python training text movies

2013-01-21 Thread Mitya Sirenef

On 01/21/2013 02:30 AM, rusi wrote:

On Jan 13, 12:08 pm, Mitya  Sirenef msire...@lightbird.net wrote:

 Sure: they play back a list of instructions on use of string methods and
 list comprehensions along with demonstration in a mock-up of the
 interpreter with a different display effect for commands typed into (and
 printed out by) the interpeter. The speed can be changed and the
 playback can be paused.

 Hi Mitya.
 What do you use for making these 'text-movies'?
 [Asking after some googling]

I'm using this script:

https://github.com/pythonbyexample/PBE/tree/master/jstmovie/

sample source file is in tmovies/src/

 -m


--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

Depression is rage spread thin.  George Santayana

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


Re: RE Help splitting CVS data

2013-01-21 Thread Alister
On Sun, 20 Jan 2013 16:41:12 -0800, Garry wrote:

 On Sunday, January 20, 2013 3:04:39 PM UTC-7, Garry wrote:
 I'm trying to manipulate family tree data using Python.
 
 I'm using linux and Python 2.7.3 and have data files saved as Linux
 formatted cvs files
 
 The data appears in this format:
 
 
 
 Marriage,Husband,Wife,Date,Place,Source,Note0x0a
 
 Note: the Source field or the Note field can contain quoted data (same
 as the Place field)
 
 
 
 Actual data:
 
 [F0244],[I0690],[I0354],1916-06-08,Neely's Landing, Cape Gir. Co,
 MO,,0x0a
 
 [F0245],[I0692],[I0355],1919-09-04,Cape Girardeau Co, MO,,0x0a
 
 
 
 code snippet follows:
 
 
 
 import os
 
 import re
 
 #I'm using the following regex in an attempt to decode the data:
 
 RegExp2 =
 ^(\[[A-Z]\d{1,}\])\,(\[[A-Z]\d{1,}\])\,(\[[A-Z]\d{1,}\])\,(\d{,4}\-\d
{,2}\-\d{,2})\,(.*|\.*\)\,(.*|\.*\)\,(.*|\.*\)
 
 #
 
 line = [F0244],[I0690],[I0354],1916-06-08,\Neely's Landing, Cape Gir.
 Co, MO\,,
 
 #
 
 (Marriage,Husband,Wife,Date,Place,Source,Note) = re.split(RegExp2,line)
 
 #
 
 #However, this does not decode the 7 fields.
 
 # The following error is displayed:
 
 Traceback (most recent call last):
 
   File stdin, line 1, in module
 
 ValueError: too many values to unpack
 
 #
 
 # When I use xx the fields apparently get unpacked.
 
 xx = re.split(RegExp2,line)
 
 #
 
  print xx[0]
 
 
 
  print xx[1]
 
 [F0244]
 
  print xx[5]
 
 Neely's Landing, Cape Gir. Co, MO
 
  print xx[6]
 
 
 
  print xx[7]
 
 
 
  print xx[8]
 
 
 
 Why is there an extra NULL field before and after my record contents?
 
 I'm stuck, comments and solutions greatly appreciated.
 
 
 
 Garry
 
 Thanks everyone for your comments.  I'm new to Python, but can get
 around in Perl and regular expressions.  I sure was taking the long way
 trying to get the cvs data parsed.
 
 Sure hope to teach myself python.  Maybe I need to look into courses
 offered at the local Jr College!
 
 Garry

don't waste time at college (at least not yet) there are many good 
tutorials available on the web.
as you are already an experienced programmer Dive into Python would not 
be a bad start  the official python tutorial is also one not to miss




-- 
Just think of a computer as hardware you can program.
-- Nigel de la Tierre
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: Python training text movies

2013-01-21 Thread Mitya Sirenef

On 01/21/2013 03:07 AM, Franck Ditter wrote:

Ok I can make my way with  jstmovie. Some remarks and questions :


 - Use encoding='utf-8' inside open of method __init__ of class Tutorial
 in jstmovie.py. Otherwise foreign languages are stuck.

 - To use the software outside Python, we need to have proper indentation
 as real spaces. We should be able to distinguish Arial type for usual
 text and fixed font for code.


Not sure I understand about indentation.. You mean like wrapping
everything in a textarea tag? Right now everything is in div,
which leads to all spaces being compressed in html when viewed.





 - Should have some colors.

 Wadda wadda byadda/b # blue annotation


I'm thinking of possibly using something like ReStructured text
and having css styles. Not sure yet.





 Cool and useful software,

 franck



Thanks!

 -m


--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

He who would learn to fly one day must first learn to stand and walk and
run and climb and dance; one cannot fly into flying.  Friedrich Nietzsche

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


Re: ANN: Python training text movies

2013-01-21 Thread Mitya Sirenef

On 01/21/2013 03:07 AM, Franck Ditter wrote:

Ok I can make my way with  jstmovie. Some remarks and questions :


 - Use encoding='utf-8' inside open of method __init__ of class Tutorial
 in jstmovie.py. Otherwise foreign languages are stuck.


Thanks, will fix this..  -m


--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

By nature's kindly disposition most questions which it is beyond a man's
power to answer do not occur to him at all.  George Santayana

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


Re: Sending a broadcast message using raw sockets

2013-01-21 Thread Rob Williscroft
Peter Steele wrote in
news:f37ccb35-8439-42cd-a063-962249b44...@googlegroups.com in
comp.lang.python: 

 I want to write a program in Python that sends a broadcast message
 using raw sockets. The system where this program will run has no IP or
 default route defined, hence the reason I need to use a broadcast
 message. 
 
 I've done some searches and found some bits and pieces about using raw
 sockets in Python, but I haven't been able to find an example that
 explains how to construct a broadcast message using raw sockets. 
 
 Any pointers would be appreciated.

This is part of my Wake-On-Lan script:

def WOL_by_mac( mac, ip = 'broadcast', port = 9 ):
  import struct, socket

  a = mac.replace( ':', '-' ).split( '-' )
  addr = struct.pack( 'B'*6, *[ int(_, 16) for _ in a ] )
  msg = b'\xff' * 6 + addr * 16

  s = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
  s.setsockopt( socket.SOL_SOCKET, socket.SO_BROADCAST, 1 )
  s.sendto( msg, ( ip, port ) )
  s.close()


The mac address is 6 pairs of hex digits seperated by '-' or ':'.

http://en.wikipedia.org/wiki/Wake-on-LAN



Rob.

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


Re: Uniquely identifying each every html template

2013-01-21 Thread Ferrous Cranus
Τη Δευτέρα, 21 Ιανουαρίου 2013 9:20:15 π.μ. UTC+2, ο χρήστης Chris Angelico 
έγραψε:
 On Mon, Jan 21, 2013 at 6:08 PM, Ferrous Cranus nikos.gr...@gmail.com wrote:
 
  An .html page must retain its database counter value even if its:
 
 
 
  (renamed  moved  contents altered)
 
 
 
 Then you either need to tag them in some external way, or have some
 
 kind of tracking operation - for instance, if you require that all
 
 renames/moves be done through a script, that script can update its
 
 pointer. Otherwise, you need magic, and lots of it.
 
 
 
 ChrisA

This python script acts upon websites other people use and
every html templates has been written by different methods(notepad++, 
dreamweaver, joomla).

Renames and  moves are performed, either by shell access or either by cPanel 
access by website owners.

That being said i have no control on HOW and WHEN users alter their html pages.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Uniquely identifying each every html template

2013-01-21 Thread Chris Angelico
On Mon, Jan 21, 2013 at 8:19 PM, Ferrous Cranus nikos.gr...@gmail.com wrote:
 This python script acts upon websites other people use and
 every html templates has been written by different methods(notepad++, 
 dreamweaver, joomla).

 Renames and  moves are performed, either by shell access or either by cPanel 
 access by website owners.

 That being said i have no control on HOW and WHEN users alter their html 
 pages.

Then I recommend investing in some magic. There's an old-established
business JW Wells  Co, Family Sorcerers. They've a first-rate
assortment of magic, and for raising a posthumous shade with effects
that are comic, or tragic, there's no cheaper house in the trade! If
anyone anything lacks, he'll find it all ready in stacks, if he'll
only look in on the resident Djinn, number seventy, Simmery Axe!

Seriously, you're asking for something that's beyond the power of
humans or computers. You want to identify that something's the same
file, without tracking the change or having any identifiable tag.
That's a fundamentally impossible task.

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


need explanation

2013-01-21 Thread kwakukwatiah
please I need some explanation on sys.stdin  and sys.stdout, and piping out-- 
http://mail.python.org/mailman/listinfo/python-list


handling return codes from CTYPES

2013-01-21 Thread Steve Simmons

PY33, Win7, Python Newbie, Not homework:-)

I'm trying to use some 'C' DLLs from Python using ctypes and I have a 
minor issue with the return valuesbut  I am new to Python; ctypes and 
using DLLs so I am at the bottom of so many learning curves, I'm not 
sure where or how to find my mistake.
When I call the DLL, I am expecting a return of 1 (success) or a 
negative number (one of a set of error conditions)the return value is 
specified as 'short' in the DLL call specification - short InitScanLib 
(const char * szLicense).   What I get back is either a 1 or something 
like 65535.  This implies that I am receiving the expected value (-1) 
but 'something' is being lost in the translation.  The code is asper the 
snippet below:


 from ctypes import *
 sLib = cdll.slib
 lic_key = c_char_p(asdfghjkl.encode(encoding='utf_8', 
errors='strict'))

 initResult = sLib.InitScanLib(lic_key.value)
 print(InitScanLib Result:  , initResult)
InitScanLib Result:   65535


I've tried declaring initResult as c_short by: inserting...

 initResult = c_short(0)

... before the call to sLib.InitScanLib but I still get the same 
response (65535).


Interactively, I can see ...
 c_short(65535)
c_short(-1)
 c_short(-1)
c_short(-1)


It's not a critical issue because I only want the return value to 
lookupa textual error message but I do want to understand what's going 
on. Any input appreciated.









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


FREE DOWNLOAD Video Games Wii

2013-01-21 Thread feefreelance
You can find may information about video games nintendo wii
Including review of PS2 Video Games, Xbox, PSP, Nintendo.
It's all here completely.
http://www.videogames-101.com

I'm confident you'll find my website very helpful!

Cheers,
Oky Ade Irmawan
lantabur - Trainee
-- 
http://mail.python.org/mailman/listinfo/python-list


why not?

2013-01-21 Thread kwakukwatiah
f = open(r'c:\text\somefile.txt')
for i in range(3):
   print str(i) + ': ' + f.readline(),
please with the print str(i) + ‘: ‘ + f.readline(), why not print str(i) + 
f.readline(),-- 
http://mail.python.org/mailman/listinfo/python-list


Re: handling return codes from CTYPES

2013-01-21 Thread Duncan Booth
Steve Simmons square.st...@gmail.com wrote:

  from ctypes import *
  sLib = cdll.slib
  lic_key = c_char_p(asdfghjkl.encode(encoding='utf_8', 
 errors='strict'))
  initResult = sLib.InitScanLib(lic_key.value)
  print(InitScanLib Result:  , initResult)
 InitScanLib Result:   65535
 
 
 I've tried declaring initResult as c_short by: inserting...
 
  initResult = c_short(0)
 
 ... before the call to sLib.InitScanLib but I still get the same 
 response (65535).

Tell the function what type to return before you call it:

InitScanLib = sLib.InitScanLib
InitScanLib.restype = c_short

See http://docs.python.org/2/library/ctypes.html#return-types

You can also tell it what parameter types to expect which will make calling 
it simpler.

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: need explanation

2013-01-21 Thread Ulrich Eckhardt

Am 21.01.2013 17:06, schrieb kwakukwat...@gmail.com:

please I need some explanation on sys.stdin  and sys.stdout, and piping out


http://www.catb.org/esr/faqs/smart-questions.html

Uli

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


Windows subprocess.call problem

2013-01-21 Thread Tom Borkin
Hi;
I have this code:

#!/Python27/python
import os, subprocess, sys
lyrics_path = /Users/Tom/Documents/lyrics
os.chdir(lyrics_path)

songs = ['livin-la-vida-loca', 'whos-that-lady']
for song in songs:
  subprocess.call(['notepad.exe', '%s.txt' % song])
my_songs_path = aa english lyrics
os.chdir(my_songs_path)
for song in my_songs:
  subprocess.call(['notepad.exe', '%s.txt' % song])
  print song

It opens the first song and hangs on subsequent songs. It doesn't open the
next song or execute the print until I have closed the first one. I want it
to open all in the list, one after another, so I have all those songs
available. Please advise.
TIA,
Tom
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Windows subprocess.call problem

2013-01-21 Thread Tim Golden
On 21/01/2013 11:25, Tom Borkin wrote:
 Hi;
 I have this code:
  
 #!/Python27/python
 import os, subprocess, sys
 lyrics_path = /Users/Tom/Documents/lyrics
 os.chdir(lyrics_path)
  
 songs = ['livin-la-vida-loca', 'whos-that-lady']
 for song in songs:
   subprocess.call(['notepad.exe', '%s.txt' % song])
 my_songs_path = aa english lyrics
 os.chdir(my_songs_path)
 for song in my_songs:
   subprocess.call(['notepad.exe', '%s.txt' % song])
   print song
  
 It opens the first song and hangs on subsequent songs. It doesn't open
 the next song or execute the print until I have closed the first one. I
 want it to open all in the list, one after another, so I have all those
 songs available. Please advise.

subprocess.call is a convenience for starting a process and waiting for
it to finish. If you want to start a process and carry on, use
subprocess.Popen directly (same params)

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


Re: ANN: Python training text movies

2013-01-21 Thread Franck Ditter
In article mailman.731.1358757093.2939.python-l...@python.org,
 Mitya Sirenef msire...@lightbird.net wrote:

   - To use the software outside Python, we need to have proper indentation
   as real spaces. We should be able to distinguish Arial type for usual
   text and fixed font for code.
 
 
 Not sure I understand about indentation.. You mean like wrapping
 everything in a textarea tag? Right now everything is in div,
 which leads to all spaces being compressed in html when viewed.

SOme spaces are translated in nbsp;, others in actual spaces.
Say for Scheme, if I write this in foo.txt :

 (define z (* 3+2i 1+i))   ; notation a+bi
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz

I get this in foo.html (spaces missing) :

 (define z (* 3+2i 1+i)) ; notation a+bi 
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz 

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


Re: Windows subprocess.call problem

2013-01-21 Thread Nobody
On Mon, 21 Jan 2013 07:25:06 -0400, Tom Borkin wrote:

 It opens the first song and hangs on subsequent songs. It doesn't open the
 next song or execute the print until I have closed the first one. I want it
 to open all in the list, one after another, so I have all those songs
 available. Please advise.

If you want to be able to keep track of the child process (e.g. to
determine when it has finished), use subprocess.Popen(). If you just want
to fire and forget, use the start shell command, e.g.:

subprocess.call(['start', 'notepad.exe', '%s.txt' % song], shell=True)

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


Re: why not?

2013-01-21 Thread Steven D'Aprano
On Mon, 21 Jan 2013 11:02:10 -0600, kwakukwatiah wrote:

 f = open(r'c:\text\somefile.txt')
 for i in range(3):
print str(i) + ': ' + f.readline(),

 please with the print str(i) + ‘: ‘ + f.readline(), 
 why not print str(i) + f.readline(),


Because the output will be different. The first code will print:

0: first line
1: second line
2: third line


The second code will print:

0first line
1second line
2third line


You should really try these things and see what they do before asking.


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


Re: need explanation

2013-01-21 Thread Steven D'Aprano
On Mon, 21 Jan 2013 10:06:41 -0600, kwakukwatiah wrote:

 please I need some explanation on sys.stdin  and sys.stdout, and piping
 out

stdin and stdout (and also stderr) are three special, standard, 
system files used by console programs that read and write text. That's 
nearly all of them.

stdin is short for standard input. Likewise for standard output and 
standard error.

When you give the Python command:

print Hello World

the string Hello World is written to stdout, which then displays it in 
the console.

stderr is similar, except that it is used for error messages. And stdin 
is used for input, rather than output.

So, in Python, I can do this:

py import sys
py sys.stdout.write(Hello world\n)
Hello world

But of course normally you would just use print.

Using sys.stdout, sys.stdin and sys.stderr in Python is usually 
considered moderately advanced. Beginners do not usually need to care 
about them.


These three special files do *not* live on the disk. There is no disk 
file called stdout unless you create one yourself, and if you do, it 
won't be special, it will just be an ordinary file with the name stdout.

These standard files are used in Unix and Linux, and less so in Windows, 
for console applications. For example, under Linux I might write this 
command:

[steve@ando ~]$ touch foo
[steve@ando ~]$ ls foo
foo

The output of the `ls` command is written to stdout, which displays it on 
the console. But I can *redirect* that output to a real file on disk:

[steve@ando ~]$ ls foo  /tmp/a
[steve@ando ~]$ cat /tmp/a
foo


Errors don't go to stdout, they go to stderr:

[steve@ando ~]$ ls bar  /tmp/a
ls: bar: No such file or directory


Because there is no file called bar, the `ls` command writes an error 
message to stderr. Even though I am redirecting stdout, I am not touching 
stderr, so it prints to the console.

Of course there is a way to redirect stderr as well:


[steve@ando ~]$ ls bar 2 /tmp/a
[steve@ando ~]$ cat /tmp/a
ls: bar: No such file or directory


Similarly, you can redirect stdin, or you can use a pipe | to turn the 
output of one command into the input of another command. This is mostly 
useful when using something like command.com in Windows, not so common in 
Python.


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


Re: Uniquely identifying each every html template

2013-01-21 Thread Ferrous Cranus
Τη Δευτέρα, 21 Ιανουαρίου 2013 11:31:24 π.μ. UTC+2, ο χρήστης Chris Angelico 
έγραψε:
 On Mon, Jan 21, 2013 at 8:19 PM, Ferrous Cranus nikos.gr...@gmail.com wrote:
 
  This python script acts upon websites other people use and
 
  every html templates has been written by different methods(notepad++, 
  dreamweaver, joomla).
 
 
 
  Renames and  moves are performed, either by shell access or either by 
  cPanel access by website owners.
 
 
 
  That being said i have no control on HOW and WHEN users alter their html 
  pages.
 
 
 
 Then I recommend investing in some magic. There's an old-established
 
 business JW Wells  Co, Family Sorcerers. They've a first-rate
 
 assortment of magic, and for raising a posthumous shade with effects
 
 that are comic, or tragic, there's no cheaper house in the trade! If
 
 anyone anything lacks, he'll find it all ready in stacks, if he'll
 
 only look in on the resident Djinn, number seventy, Simmery Axe!
 
 
 
 Seriously, you're asking for something that's beyond the power of
 
 humans or computers. You want to identify that something's the same
 
 file, without tracking the change or having any identifiable tag.
 
 That's a fundamentally impossible task.

No, it is difficult but not impossible.
It just cannot be done by tagging the file by:

1. filename
2. filepath
3. hash (math algorithm producing a string based on the file's contents)

We need another way to identify the file WITHOUT using the above attributes.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Forcing Python to detect DocumentRoot

2013-01-21 Thread Dave Angel

On 01/21/2013 01:25 AM, Ferrous Cranus wrote:

Τη Σάββατο, 19 Ιανουαρίου 2013 10:01:15 μ.μ. UTC+2, ο χρήστης Piet van Oostrum 
έγραψε:

Ferrous Cranus nikos.gr...@gmail.com writes:



While

/home/nikos/public_html/cafebar-idea.gr/cgi-bin/counter.py

that has also embedded this line:

a href=mailto:supp...@superhost.gr; img src=/data/images/mail.png /a

cannnot open the file normally.

And the questions iw WHY since python script can open ANY filesystempath
file the user has access too.



As Piet has said,Python is NOT opening the file mail.png.  When the html 
is sent to the browser, and the browser requests that image file, it's 
the server itself who figures out where the actual file is.  Python 
isn't involved at all.


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


Re: Uniquely identifying each every html template

2013-01-21 Thread Oscar Benjamin
On 21 January 2013 12:06, Ferrous Cranus nikos.gr...@gmail.com wrote:
 Τη Δευτέρα, 21 Ιανουαρίου 2013 11:31:24 π.μ. UTC+2, ο χρήστης Chris Angelico 
 έγραψε:

 Seriously, you're asking for something that's beyond the power of
 humans or computers. You want to identify that something's the same
 file, without tracking the change or having any identifiable tag.

 That's a fundamentally impossible task.

 No, it is difficult but not impossible.
 It just cannot be done by tagging the file by:

 1. filename
 2. filepath
 3. hash (math algorithm producing a string based on the file's contents)

 We need another way to identify the file WITHOUT using the above attributes.

This is a very old problem (still unsolved I believe):
http://en.wikipedia.org/wiki/Ship_of_Theseus


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


Re: Uniquely identifying each every html template

2013-01-21 Thread Joel Goldstick
This is trolling Ferrous.  you are a troll.  Go away


On Mon, Jan 21, 2013 at 7:39 AM, Oscar Benjamin
oscar.j.benja...@gmail.comwrote:

 On 21 January 2013 12:06, Ferrous Cranus nikos.gr...@gmail.com wrote:
  Τη Δευτέρα, 21 Ιανουαρίου 2013 11:31:24 π.μ. UTC+2, ο χρήστης Chris
 Angelico έγραψε:
 
  Seriously, you're asking for something that's beyond the power of
  humans or computers. You want to identify that something's the same
  file, without tracking the change or having any identifiable tag.
 
  That's a fundamentally impossible task.
 
  No, it is difficult but not impossible.
  It just cannot be done by tagging the file by:
 
  1. filename
  2. filepath
  3. hash (math algorithm producing a string based on the file's contents)
 
  We need another way to identify the file WITHOUT using the above
 attributes.

 This is a very old problem (still unsolved I believe):
 http://en.wikipedia.org/wiki/Ship_of_Theseus


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




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


Re: Uniquely identifying each every html template

2013-01-21 Thread alex23
On Jan 21, 10:39 pm, Oscar Benjamin oscar.j.benja...@gmail.com
wrote:
 This is a very old problem (still unsolved I 
 believe):http://en.wikipedia.org/wiki/Ship_of_Theseus

+1 internets for referencing my most favourite thought experiment
ever :)

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


Re: Uniquely identifying each every html template

2013-01-21 Thread alex23
On Jan 21, 7:19 pm, Ferrous Cranus nikos.gr...@gmail.com wrote:
 Renames and  moves are performed, either by shell access or either by cPanel 
 access by website owners.

These websites owners, are you charging them for this service you
provide?

You seriously need to read up on some fundamentals of how the web +
apache + Python works. As it stands, you're asking us to do your job
for you, and it's getting TEDIOUS with you TELLING us how WRONG we are.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Windows subprocess.call problem

2013-01-21 Thread Dave Angel

On 01/21/2013 06:25 AM, Tom Borkin wrote:

Hi;
I have this code:
snip
for song in my_songs:
   subprocess.call(['notepad.exe', '%s.txt' % song])
   print song

It opens the first song and hangs on subsequent songs. It doesn't open the
next song or execute the print until I have closed the first one. I want it
to open all in the list, one after another, so I have all those songs
available. Please advise.


Why not just pass all the filenames as parameters in one invocation of 
notepad?  Assuming Notepad is written reasonably, that'll give it all to 
you in one window, instead of opening many separate ones.



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


Re: RE Help splitting CVS data

2013-01-21 Thread Neil Cerutti
On 2013-01-21, Garry ggkrae...@gmail.com wrote:
 Thanks everyone for your comments.  I'm new to Python, but can
 get around in Perl and regular expressions.  I sure was taking
 the long way trying to get the cvs data parsed.  

 Sure hope to teach myself python.  Maybe I need to look into
 courses offered at the local Jr College!
  
There's more than enough free resources online for the
resourceful Perl programmer to get going. It sounds like you
might be interested in Text Processing in Python.

http://gnosis.cx/TPiP/

Also good for your purposes is Dive Into Python.

http://www.diveintopython.net/

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


The most important website in the world for any entrepreneur

2013-01-21 Thread Web Developers
Hello,
We just launched our new site - www.webmeeters.com a couple of days
back.
It allows the formation of virtual companies made up of workers from
around the world, and then allows them to be crowd-funded for any
business idea they may have.
The site can be used by anyone - someone in the corporate world,
musicians, artists, whatever.

So... please check it out, and if you like it, we'd appreciate you
spreading the word and telling all your friends :)

Thanks,
The Webmaster,
www.webmeeters.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Forcing Python to detect DocumentRoot

2013-01-21 Thread Ferrous Cranus
Τη Δευτέρα, 21 Ιανουαρίου 2013 2:33:22 μ.μ. UTC+2, ο χρήστης Dave Angel έγραψε:
 On 01/21/2013 01:25 AM, Ferrous Cranus wrote:
 
  Τη Σάββατο, 19 Ιανουαρίου 2013 10:01:15 μ.μ. UTC+2, ο χρήστης Piet van 
  Oostrum έγραψε:
 
  Ferrous Cranus nikos.gr...@gmail.com writes:
 
 
 
  While
 
 
 
  /home/nikos/public_html/cafebar-idea.gr/cgi-bin/counter.py
 
 
 
  that has also embedded this line:
 
 
 
  a href=mailto:supp...@superhost.gr; img src=/data/images/mail.png 
  /a
 
 
 
  cannnot open the file normally.
 
 
 
  And the questions iw WHY since python script can open ANY filesystempath
 
  file the user has access too.
 
 
 
 
 
 As Piet has said,Python is NOT opening the file mail.png.  When the html 
 
 is sent to the browser, and the browser requests that image file, it's 
 
 the server itself who figures out where the actual file is.  Python 
 
 isn't involved at all.
 
 
 
 -- 
 
 DaveA

Yes Dave so we need to remove img src=/data/images/mail.png  since the 
apache cant see to open it and let Python open it which we know it can because 
it has access to any system file the user has access too.

httpd cannot open this file because the location of the image is past the addon 
domain's Document Root.

/home/nikos/public_html/cafebar-idea.gr = Addon's Domain Document Root

/home/nikos/public_html/data/images/mail.png = where the image file is located

and the python scipt is on:

/home/nikos/public_html/cafebar-idea.gr/cgi-bin/counter.py

So if a python script can open any file the user has access too then we need a 
python way of opening this file.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Uniquely identifying each every html template

2013-01-21 Thread Ferrous Cranus
Τη Δευτέρα, 21 Ιανουαρίου 2013 2:47:54 μ.μ. UTC+2, ο χρήστης Joel Goldstick 
έγραψε:
 This is trolling Ferrous.  you are a troll.  Go away

Just because you cannot answer my question that doesn't make me a troll you 
know.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Uniquely identifying each every html template

2013-01-21 Thread Ferrous Cranus
Τη Δευτέρα, 21 Ιανουαρίου 2013 2:56:24 μ.μ. UTC+2, ο χρήστης alex23 έγραψε:
 On Jan 21, 7:19 pm, Ferrous Cranus nikos.gr...@gmail.com wrote:
 
  Renames and  moves are performed, either by shell access or either by 
  cPanel access by website owners.
 
 
 
 These websites owners, are you charging them for this service you
 
 provide?
 
 
 
 You seriously need to read up on some fundamentals of how the web +
 
 apache + Python works. As it stands, you're asking us to do your job
 
 for you, and it's getting TEDIOUS with you TELLING us how WRONG we are.

Dude, i host 4 sites of friend fo mine who want the same type of counter like i 
use iun my website.

ALL, iam asking for is a way to make this work.

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


Re: Uniquely identifying each every html template

2013-01-21 Thread Ferrous Cranus
Τη Δευτέρα, 21 Ιανουαρίου 2013 9:20:15 π.μ. UTC+2, ο χρήστης Chris Angelico 
έγραψε:
 On Mon, Jan 21, 2013 at 6:08 PM, Ferrous Cranus nikos.gr...@gmail.com wrote:
 
  An .html page must retain its database counter value even if its:
 
 
 
  (renamed  moved  contents altered)
 
 
 
 Then you either need to tag them in some external way, or have some
 
 kind of tracking operation - for instance, if you require that all
 
 renames/moves be done through a script, that script can update its
 
 pointer. Otherwise, you need magic, and lots of it.
 
 
 
 ChrisA


Perhaps we should look into on how's the OS handles the file to get an idea on 
how its done?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: handling return codes from CTYPES

2013-01-21 Thread Mike C. Fletcher

On 13-01-21 05:46 AM, Steve Simmons wrote:

...

 from ctypes import *
 sLib = cdll.slib
 lic_key = c_char_p(asdfghjkl.encode(encoding='utf_8', 
errors='strict'))

 initResult = sLib.InitScanLib(lic_key.value)
 print(InitScanLib Result:  , initResult)
InitScanLib Result:   65535


I've tried declaring initResult as c_short by: inserting...

 initResult = c_short(0)

... before the call to sLib.InitScanLib but I still get the same 
response (65535).

That's because you've just discarded the object you created.

What you wanted was, I believe:

initScanLib = sLib.InitScanLib
initScanLib.restype = c_short

initResult = initScanLib( ... )

i.e. you tell the initScanLib function how to coerce its result-type.  
*Some* C functions take a pointer to a data-value to fill in their data, 
but not *your* function.  That pattern looks like:


result = c_short(0)
my_ctypes_function( ..., byref(result) )
print result.value

i.e. you have to pass the variable into the function (as a 
reference/pointer).


HTH,
Mike

--

  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com

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


Re: Else statement executing when it shouldnt

2013-01-21 Thread eli m
On Sunday, January 20, 2013 9:56:59 PM UTC-8, alex23 wrote:
 On Jan 21, 2:40 pm, eli m techgeek...@gmail.com wrote:
 
  an else statement is running when it shouldnt be. It is
 
  on the last line. Whenever i am in the math or game
 
  function, when i type in main, it goes back to the start
 
  of the program, but it also says not a valid function.
 
  I am stumped!
 
 
 
 Here is your code with the irrelevancy stripped away:
 
 
 
 function = raw_input(Type in a function:)
 
 #start math loop
 
 if function == math:
 
 #math code
 
 if function == random number:
 
 #random code
 
 if function == games:
 
 #games code
 
 if function == help:
 
 #help code
 
 else:
 
 print (Not a valid function)
 
 
 
 Say you enter 'math'. It passes the first condition, so runs the math
 
 code.
 
 It then fails on the next 3 conditions, the last of which has an else,
 
 so if you type _anything_ other than 'help', you'll see Not a valid
 
 function.
 
 
 
 Easy answer, use `elif` (else if) instead of else for the subsequent
 
 tests:
 
 
 
 if function == math:
 
 #math code
 
 elif function == random number:
 
 #random code
 
 elif function == games:
 
 #games code
 
 elif function == help:
 
 #help code
 
 else:
 
 print (Not a valid function)
 
 
 
 Better answer: read up on real functions, and look into dictionary
 
 dispatch:
 
 
 
 def f_math():
 
#math code
 
 
 
 def f_random_number():
 
#random code
 
 
 
 etc
 
 
 
 function_dispatcher = {
 
 'math': f_math,
 
 'random number': f_random_number,
 
 etc
 
 }
 
 
 
while cmd == 0:
 
function_name = raw_input(Type in a function:)
 
if function_name in function_dispatcher:
 
function_dispatcher[function_name]()
 
else:
 
print(Not a valid function)
 
 
 
 To have your functions break out of the loop, use a `global` variable
 
 or pass a context object into each function to allow them to set
 
 `cmd`.

Thank you, that solved my problem. Sorry for my posts, i am a noob and this is 
my first time posting on here.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Forcing Python to detect DocumentRoot

2013-01-21 Thread Michael Torrie
On 01/18/2013 06:02 AM, Ferrous Cranus wrote:
 Yes my Python scripts exist in a linux web host.
 
 os.environ['HOME'] will indeed give the home directory of the user.
 
 to me /home/nikos/
 
 but i want a variable to point to
 
 /home/nikos/public_html whice is called DocumentRoot.

Not it's not.  There is nothing in the operating system that defines this.

 is there avariable for that? i can't seem to find any...

Not there's nothing in the operating system that specifies this.  This
is a convention that makes sense only to the apache daemon itself.  If
your python script is running as a CGI script, then apache will set
environment variables that you can read with the os module.  See the
Apache docs for information on this.

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


Re: why not?

2013-01-21 Thread Lie Ryan

On 22/01/13 04:02, kwakukwat...@gmail.com wrote:

f = open(r'c:\text\somefile.txt')
for i in range(3):
print str(i) + ': ' + f.readline(),
please with the print str(i) + ‘: ‘ + f.readline(), why not print str(i)
+ f.readline(),


Try running both code. What do you see? What's the difference? When do 
you think you might want one or the other?



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


Re: Forcing Python to detect DocumentRoot

2013-01-21 Thread Ferrous Cranus
Ok i see its just a convention.
Can you help on this:

so we need to remove img src=/data/images/mail.png  since the apache cant 
see to open it and let Python open it which we know it can because it has 
access to any system file the user has access too. 

httpd cannot open this file because the location of the image is past the addon 
domain's Document Root. 

/home/nikos/public_html/cafebar-idea.gr = Addon's Domain Document Root 

/home/nikos/public_html/data/images/mail.png = where the image file is located 

and the python scipt is on: 

/home/nikos/public_html/cafebar-idea.gr/cgi-bin/counter.py 

So if a python script can open any file the user has access too then we need a 
python way of opening this file. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Slightly OT: What metro areas are best for a software development career?

2013-01-21 Thread Jason Hsu
I am looking for a position as a software development engineer.  I'm currently 
learning to develop Android apps (http://www.jasonhsu.com/android-apps), and I 
use Python for implementing Doppler Value Investing 
(http://www.dopplervalueinvesting.com) and for developing Swift Linux 
(http://www.swiftlinux.org).  NOTE: Thanks to those of you who answered the 
questions I asked as I developed Doppler Value Investing.

I currently live in Minnesota about 50 miles west of Minneapolis, and I am 
considering moving.  What are the best metro areas (Silicon Valley, Los 
Angeles, San Diego, Chicago, Twin Cities, Boston, NYC, DC, etc.) for a software 
development career, how would you rank them, and why?

The Twin Cities metro area has a technical community portal called 
http://tech.mn .  Are there analogous technical community portals for other 
metro areas?
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Thorough Python 2.7.3 Windows Build Documentation?

2013-01-21 Thread Leonard, Arah
Hello again Python programmers,

Final update on my Python 2.7.3 build issues.  After much insanity I 
finally used a process sniffer when running Python and tracked down that 
because of a path environment variable and the stupidity of Microsoft, Windows 
was loading another python27.dll rather than the one in the directory with the 
python.exe that I built, thus rendering my former tests useless.  Sorting this 
out using the .exe.local trick, I was able to re-test everything and come to 
reliable conclusions.  Based on performance results, it is without a doubt in 
my mind that the Python 2.7.3 precompiled binaries in the MSI are a PGO build.  
I can now build my own binaries with the same performance as the released 
precompiled binaries.  And on my machine at least, these PGO built binaries do 
perform 30-36% faster than a normal release build.  Useful information if 
you're doing your own Python builds.  I'd still like to see Python start 
including some thorough build documentation on each release, but I'm certainly 
not 
 going to be holding my breath on that.  ;)  Cheers.

Sincerely,
Arah Leonard
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Slightly OT: What metro areas are best for a software development career?

2013-01-21 Thread Matt Jones
Check out this article.  It lists some information about IT/Sofware jobs
and places where you can get them.  I recommend Austin personally, as I've
lived for a number of years.

http://msn.careerbuilder.com/Article/MSN-3218-Job-Info-and-Trends-A-closer-look-at-the-fast-growing-technology-field/?SiteId=cbmsn43218sc_extcmp=JS_3218_advice

*Matt Jones*


On Mon, Jan 21, 2013 at 10:18 AM, Jason Hsu jhsu802...@gmail.com wrote:

 I am looking for a position as a software development engineer.  I'm
 currently learning to develop Android apps (
 http://www.jasonhsu.com/android-apps), and I use Python for implementing
 Doppler Value Investing (http://www.dopplervalueinvesting.com) and for
 developing Swift Linux (http://www.swiftlinux.org).  NOTE: Thanks to
 those of you who answered the questions I asked as I developed Doppler
 Value Investing.

 I currently live in Minnesota about 50 miles west of Minneapolis, and I am
 considering moving.  What are the best metro areas (Silicon Valley, Los
 Angeles, San Diego, Chicago, Twin Cities, Boston, NYC, DC, etc.) for a
 software development career, how would you rank them, and why?

 The Twin Cities metro area has a technical community portal called
 http://tech.mn .  Are there analogous technical community portals for
 other metro areas?
 --
 http://mail.python.org/mailman/listinfo/python-list

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


RE: Slightly OT: What metro areas are best for a software development career?

2013-01-21 Thread Leonard, Arah
 I am looking for a position as a software development engineer.  I'm 
 currently learning to develop Android apps 
 (http://www.jasonhsu.com/android-apps), and I use
 Python for implementing Doppler Value Investing 
 (http://www.dopplervalueinvesting.com) and for developing Swift Linux 
 (http://www.swiftlinux.org).  NOTE: Thanks
 to those of you who answered the questions I asked as I developed Doppler 
 Value Investing.

 I currently live in Minnesota about 50 miles west of Minneapolis, and I am 
 considering moving.  What are the best metro areas (Silicon Valley, Los 
 Angeles, San Diego, 
 Chicago, Twin Cities, Boston, NYC, DC, etc.) for a software development 
 career, how would you rank them, and why?

 The Twin Cities metro area has a technical community portal called 
 http://tech.mn .  Are there analogous technical community portals for other 
 metro areas?

Well, for what it's worth, I've literally moved from coast to coast and from my 
experience, that really depends entirely on what kind of programming you want 
to do.  Nevada has lots of jobs for casino-style gaming software development.  
Texas has a lot of industrial programming for oil rigs.  Washington (state) has 
a lot of Microsoft-related jobs.  Portland, Oregon has a lot of Intel-related 
jobs.  Etc.  (Pennsylvania just kind of sucked.)  In most cases it's about what 
major business is in the area.  So I'd say if you're not looking to be near 
your family or anything non-work related, then just ask yourself what you want 
to do, look up who does it best and where their main offices are located, and 
then apply for jobs there.  Even if you don't get the dream job on the get-go, 
just getting a job that helps you move into the area makes it that much easier 
to continue applying for your dream job over the years.

So you say that you're currently developing Android apps.  Google is Android, 
so I'd suggest looking more around the Mountain View, CA area.

(I wouldn't count on a Python-specific career anywhere though.  Those kinds of 
jobs are ones that you have to chase to the oddest ends of the Earth because 
they're so rare.)

Or, if you're just happy being a general programmer or switching things up a 
lot, then aim for the more heavily populated areas like Silicon Valley and 
prepare to be chewed up and spat out by random companies while you grow in 
experience.

Just make sure to look into the cost of living in and around the area that you 
want to move to, keeping various forms of commuting in mind, so that you can 
plan for how you'll pay the rent once you find a job you like.  ;)  
Fortunately, most major metro areas have good forms of public transportation.  
(Maybe not enjoyable, but dependable and affordable at least.)

That, and if you have any allergies or medical conditions, keep in mind the 
area.  Portland, OR was a lovely place to be my first year there, but my second 
spring there the pollen counts shot through the roof so I had to leave after a 
really bad bout of bronchitis.  So if you have any health issues, research the 
area well.  Even a whole year of living there isn't always enough to prove the 
area safe.

And good luck!

Sincerely,
Arah Leonard
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Thorough Python 2.7.3 Windows Build Documentation?

2013-01-21 Thread Stephane Wirtel
Hi Leonard,

Please, could you limit your text to 80 columns, because it's
unreadable. Your text is too long :(

Thank you in advance.

Stéphane

* Leonard, Arah arah.leon...@bruker-axs.com [2013-01-17 15:29:28 +]:

 Hello fellow Python programmers,
 
 I'm building a 32-bit CPython 2.7.3 distro for Windows using the MS Visual 
 Studio Professional 2008 SP1 (and all hotfixes) MSVC 9 compiler.  My build 
 works, technically, but it also happens to benchmark over 30% slower than the 
 precompiled binaries in the distributed Python 2.7.3 MSI.  Can anyone point 
 me in the direction of some thoroughly detailed build documentation so that I 
 can figure out how to get that 30% back with my build?  The only 
 documentation that I can find just says MSVC 9, period.  There's no mention 
 of SP1 or not, hotfixes, nor of any specific compiler/linker optimizations 
 used to build the official distro.  Something, somewhere, has to be 
 significantly different between our builds for a 30% performance difference, 
 and it'd probably be handy for the Python community to know how to avoid the 
 same pitfall that cost me performance so that we can all get the most out of 
 Python.  Any and all help will be greatly appreciated.  Thanks.
 
 Sincerely,
 Arah Leonard
 
 Arah Leonard
 Software Development Engineer
 
 
 
 Bruker AXS Inc.
 5465 East Cheryl Parkway
 Madison, WI 53711
 US   Phone: +1 608-276-3812
  Phone: +1 800-234-XRAY(9729)
  Fax:
 
 
   arah.leon...@bruker-axs.commailto:arah.leon...@bruker-axs.com
   www.bruker.comhttp://www.bruker.com/
 
 
 
 The information contained in this email is confidential. It is intended 
 solely for the addressee. Access to this email by anyone else is 
 unauthorized. If you are not the intended recipient, any form of disclosure, 
 reproduction, distribution or any action taken or refrained from in reliance 
 on it, is prohibited and may be unlawful. Please notify the sender 
 immediately.
 
 

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


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


Re: Thorough Python 2.7.3 Windows Build Documentation?

2013-01-21 Thread Irmen de Jong
On 21-1-2013 18:16, Stephane Wirtel wrote:
 Hi Leonard,
 
 Please, could you limit your text to 80 columns, because it's
 unreadable. Your text is too long :(

Stephane, shouldn't your news reader simply wrap the lines...? At least mine 
does.
(Thunderbird)

Irmen

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


Re: Forcing Python to detect DocumentRoot

2013-01-21 Thread Michael Torrie
On 01/21/2013 09:02 AM, Ferrous Cranus wrote:
 Ok i see its just a convention. Can you help on this:
 
 so we need to remove img src=/data/images/mail.png  since the
 apache cant see to open it and let Python open it which we know it
 can because it has access to any system file the user has access too.

Is this link generated by your python CGI script?  If so you'll have to
work out some way for your python script to interact with Apache and ask
it where the document root is.

If this link is in static html, then you simply need to fix your html to
make the link valid.  Or maybe you need to modify your apache
installation so that it knows where /data is using an alias directive
in your apache config.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Forcing Python to detect DocumentRoot

2013-01-21 Thread Michael Torrie
On 01/21/2013 07:55 AM, Ferrous Cranus wrote:
 Yes Dave so we need to remove img src=/data/images/mail.png
 since the apache cant see to open it and let Python open it which we
 know it can because it has access to any system file the user has
 access too.

What are you trying to accomplish?  I don't see how opening the file
with python will do anything because as has been said many times on this
thread, your python CGI generates html code which the browser then
renders.  Opening an image file with python will do nothing useful.

 So if a python script can open any file the user has access too then
 we need a python way of opening this file.

Still don't understand why you want python to open the image file.  What
do you want python to do with it?  It's running on a web server, so
there's no screen for python to display the image too.

Technically it is possible to have a script that opens the image and
serves it up as a binary stream to the browser using the image
content-type header, but it's way more efficient to serve up the file
statically.  And you'd have to have a proper link in the html code
anyway, to refer to your image-serving CGI script.

Methinks you're barking up the wrong tree with python opening the image
file.

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


Re: Else statement executing when it shouldnt

2013-01-21 Thread Chris Angelico
On Tue, Jan 22, 2013 at 2:37 AM, eli m techgeek...@gmail.com wrote:
 Thank you, that solved my problem. Sorry for my posts, i am a noob and this 
 is my first time posting on here.

There's nothing wrong with being a noob, we all start out that way.
Want to be one of the people we love to help? Here are some tips:

http://www.catb.org/esr/faqs/smart-questions.html

It's longish, but you'll find it helpful. The principles laid out in
that document govern pretty much every geeky forum, and a good number
of others besides.

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


Re: Forcing Python to detect DocumentRoot

2013-01-21 Thread Michael Torrie
On 01/19/2013 01:01 AM, Ferrous Cranus wrote:
 # render html template and print it data = f.read() counter =
 '''center a href=mailto:supp...@superhost.gr; img
 src=/data/images/mail.png /a
 
 table border=2 cellpadding=2 bgcolor=black tdfont color=lime
 Αριθμός Επισκεπτών /td tdfont color=cyan %d /td''' % hits[0] 
 
 
 While from within the same counter.py file
 
 # open html template file f = open(
 '/home/nikos/public_html/test.txt' )
 
 opens OK the page file which is also past addons domain's document
 root
 
 Can you help counter.py to load the image? Why does it fail to load
 it? Python can have access to ANY filesystempath , no matter from
 what folder counter.py script runs from. Correct?

No I can't because counter.py doesn't load the image.  The browser
does.  If the image fails to load it is because the apache web server
cannot find it.  In other words your image src url is bad.  It has
nothing to do with python.  Python is only spitting out html code.
That's it.  Image loading is done by apache on behalf of a request from
the web browser.  Since the url is a direct url to a file, there is no
CGI that runs.

I understand that you have a difficulty understanding the relationship
between the browser, the web server, and the cgi script.  The process
goes like this:

- browser requests the url, which happens to be the CGI script, counter.py.
- web server runs counter.py returns html code to the browser.
- browser parses html code, renders it, and requests any images that the
html code references.
- Web server tries to locate the image based on its own rules and
config, and serves it if possible, otherwise, returns error 404.

So you simply have the image url wrong.  apache is not mapping /data to
where you think it is.  You have to either fix this in apache's configs,
or determine where the image really is in apache's url space, and change
the cgi to output the correct html.  Your problem isn't a python one at
all; it's an apache problem.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Forcing Python to detect DocumentRoot

2013-01-21 Thread Piet van Oostrum
Ferrous Cranus nikos.gr...@gmail.com writes:

 Ok i see its just a convention.
 Can you help on this:

 so we need to remove img src=/data/images/mail.png  since the apache cant 
 see to open it and let Python open it which we know it can because it has 
 access to any system file the user has access too. 

 httpd cannot open this file because the location of the image is past the 
 addon domain's Document Root. 

 /home/nikos/public_html/cafebar-idea.gr = Addon's Domain Document Root 

 /home/nikos/public_html/data/images/mail.png = where the image file is 
 located 

 and the python scipt is on: 

 /home/nikos/public_html/cafebar-idea.gr/cgi-bin/counter.py 

 So if a python script can open any file the user has access too then we need 
 a python way of opening this file. 

So why don't you put the image at  
/home/nikos/public_html/cafebar-idea.gr/data/images/mail.png?
-- 
Piet van Oostrum p...@vanoostrum.org
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
http://mail.python.org/mailman/listinfo/python-list


serpent, a serializer based around ast.literal_eval

2013-01-21 Thread Irmen de Jong
Hi,

I've been toying a bit with ast.literal_eval. I've come up with serpent, a 
serializer
based around that. Which means that it takes a Python object tree and turns it 
into a
serialized form that can be safely read back by ast.literal_eval().

Why I wrote serpent and didn't simply use repr()+ast.literal_eval:

* it serializes directly to bytes (utf-8 encoded), instead of a string, so it 
can
immediately be saved to a file or sent over a socket
* it encodes byte-types as base-64 instead of inefficient escaping notation 
that repr
would use (this does mean you have to base-64 decode these strings manually on 
the
receiving side to get your bytes back)
* it contains a few custom serializers for several additional Python types such 
as uuid,
datetime, array and decimal
* it tries to serialize unrecognised types as a dict (you can control this with
__getstate__ on your own types)
* it can create a pretty-printed (indented) output for readability purposes
* it works around a few quirks of ast.literal_eval() on the various Python 
implementations.

It works with Python 2.6+ (including 3.x), IronPython 2.7+, Jython 2.7+.

Serpent can be downloaded from Pypi: http://pypi.python.org/pypi/serpent
A simple example session can be seen here: https://gist.github.com/4588429


I'm considering writing Java and .NET counterparts for this as well so I'll be 
able to
exchange messages between the three.

What do you think? Would you consider this useful at all?


Cheers
Irmen de Jong
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: handling return codes from CTYPES

2013-01-21 Thread Steve Simmons

Mike,

Thanks for your response - I was puzzled by one part of it though...

   On 21/01/2013 15:14, Mike C. Fletcher wrote:

That's because you've just discarded the object you created


I (mis?)understood from the ctypes documentation that ' initResult = 
c_short(0)' would result in the creation of a ctypes 'short' called 
initResult and that this object would be mutable.  On that basis, I 
expected the following statement ' initResult = initScanLib( ... )' 
would assign the result of the call to initResult.


So, I can understand that I am not using the correct approach but I 
don't understand how I discarded the object I created.  Can you clarify 
please?


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


Re: handling return codes from CTYPES

2013-01-21 Thread MRAB

On 2013-01-21 16:52, Steve Simmons wrote:

Mike,

Thanks for your response - I was puzzled by one part of it though...

 On 21/01/2013 15:14, Mike C. Fletcher wrote:

That's because you've just discarded the object you created


I (mis?)understood from the ctypes documentation that ' initResult =
c_short(0)' would result in the creation of a ctypes 'short' called
initResult and that this object would be mutable.  On that basis, I
expected the following statement ' initResult = initScanLib( ... )'
would assign the result of the call to initResult.

So, I can understand that I am not using the correct approach but I
don't understand how I discarded the object I created.  Can you clarify
please?


This:

initResult = initScanLib( ... )

will make initResult refer to whatever initScanLib(...) returned, just
as this:

initResult = c_short(0)

will make initResult refer to whatever c_short(0) returned.

What you were doing was this:

1. You created a c_short object and bound initResult to it.

2. You called a function and bound initResult to its result, unbinding
the c_short object in the process.

3. There were no other references to the c_short object, therefore it 
could be discarded by the garbage collector.


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


Re: handling return codes from CTYPES

2013-01-21 Thread Mike C. Fletcher

On 13-01-21 11:52 AM, Steve Simmons wrote:

Mike,

Thanks for your response - I was puzzled by one part of it though...

   On 21/01/2013 15:14, Mike C. Fletcher wrote:

That's because you've just discarded the object you created


I (mis?)understood from the ctypes documentation that ' initResult 
= c_short(0)' would result in the creation of a ctypes 'short' called 
initResult and that this object would be mutable.  On that basis, I 
expected the following statement ' initResult = initScanLib( ... )' 
would assign the result of the call to initResult.


So, I can understand that I am not using the correct approach but I 
don't understand how I discarded the object I created.  Can you 
clarify please?
Sure, the problem isn't here a ctypes issue, but a Python one.  When you 
do the following:


 initResult = c_short(0)

you have bound the name initResult (a string key in a namespace 
dictionary) to a ctypes c_short object.  The name initResult is in no 
way special, nor is there any type associated with that variable 
name.  The fact that it has been assigned to a c_short *at this moment* 
does not affect any *future* value assigned to that name.


 initResult = initScanLib( ... )

Here you have assigned whatever object is the result of initScanLib( ... 
) to the name initResult.  The old object pointed to by initResult 
is no longer referenced by that name, so the Python intepreter is free 
to discard that old object immediately.  Thus you have discarded the 
object you created by reassigning the single reference to it to another 
object, which leaves it free to be garbage collected (depending on 
Python implementation that might be instantly or eventually).


Python does not have typed *variables*, every variable is a pointer to 
an object (PyObject *) under the covers.  There is nothing in Python like:


int i;
short j;

nothing which makes a variable type-enforcing or constrained.  At least, 
nothing in core Python. In theory you can create a namespace which 
*does* allow such things, but that's getting pretty involved.


Hope that helps,
Mike

--

  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com

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


Re: Uniquely identifying each every html template

2013-01-21 Thread Piet van Oostrum
Ferrous Cranus nikos.gr...@gmail.com writes:

 This python script acts upon websites other people use and every html
 templates has been written by different methods(notepad++,
 dreamweaver, joomla).

 Renames and moves are performed, either by shell access or either by
 cPanel access by website owners.

 That being said i have no control on HOW and WHEN users alter their html 
 pages.

Under these circumstances the only way to solve it is to put an
identification *inside* the file and make sure it will not be changed.
It could for example be some invisible piece of HTML, or an attribute to
some tag. If that can't be done the problem cannot be solved and it
makes no sense keeping asking the same question over and over again.
-- 
Piet van Oostrum p...@vanoostrum.org
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: need explanation

2013-01-21 Thread Chris Angelico
On Tue, Jan 22, 2013 at 3:06 AM,  kwakukwat...@gmail.com wrote:
 please I need some explanation on sys.stdin  and sys.stdout, and piping out

Try the documentation or a web search. If that doesn't help, ask a
specific question.

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


Re: Thorough Python 2.7.3 Windows Build Documentation?

2013-01-21 Thread Stephane Wirtel
* Irmen de Jong irmen.nos...@xs4all.nl [2013-01-21 19:22:55 +0100]:

 On 21-1-2013 18:16, Stephane Wirtel wrote:
  Hi Leonard,
  
  Please, could you limit your text to 80 columns, because it's
  unreadable. Your text is too long :(
 
 Stephane, shouldn't your news reader simply wrap the lines...? At least mine 
 does.
 (Thunderbird)
 
I removed Thunderbird during the last month because I had a big problem
of performance with the memory and the CPU :(

Sorry, I dropped it

About the limit of 80, this is a problem of typography :(

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


Re: Uniquely identifying each every html template

2013-01-21 Thread Dave Angel

On 01/21/2013 07:06 AM, Ferrous Cranus wrote:



 snip


Seriously, you're asking for something that's beyond the power of

humans or computers. You want to identify that something's the same

file, without tracking the change or having any identifiable tag.

That's a fundamentally impossible task.


No, it is difficult but not impossible.
It just cannot be done by tagging the file by:

1. filename
2. filepath
3. hash (math algorithm producing a string based on the file's contents)

We need another way to identify the file WITHOUT using the above attributes.



Repeating the same impossible scenario won't solve it.  You need to find 
some other way to recognize the file.  If you can't count on either 
name, location, or content, you can't do it.


Try solving the problem by hand.  If you examine the files, and a 
particular one has both changed names and content, how are you going to 
decide that it's the same one?   Define same in a way that you could 
do it by hand, and you're halfway towards a programming solution.


Maybe it'd be obvious from an analogy.  Suppose you're HR for a company 
with 100 employees, and a strange policy of putting paychecks under the 
wipers of the employees' windshields.  All the employee cars are kept 
totally clean of personal belongings, with no registration or license 
plates.  The lot has no reserved parking places, so every car has a 
random location.


For a while, you just memorize the make/model/color of each car, and 
everything's fine.  But one day several of the employees buy new cars. 
How do you then associate each car with each employee?


I've got it - you require each one to keep a numbered parking sticker, 
and they move the sticker when they get a new car.


Or, you give everyone a marked, reserved parking place.

Or you require each employee to report any car exchanges to you, so you 
can update your records.


If you can solve this one, you can probably solve the other one.  Until 
then, we have no spec.




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


Re: ANN: Python training text movies

2013-01-21 Thread Mitya Sirenef

On 01/21/2013 06:30 AM, Franck Ditter wrote:

In article  mailman.731.1358757093.2939.python-l...@python.org,

 Mitya Sirenef msire...@lightbird.net wrote:

  - To use the software outside Python, we need to have proper 
indentation

  as real spaces. We should be able to distinguish Arial type for usual
  text and fixed font for code.


 Not sure I understand about indentation.. You mean like wrapping
 everything in a textarea tag? Right now everything is in div,
 which leads to all spaces being compressed in html when viewed.

 SOme spaces are translated in nbsp;, others in actual spaces.
 Say for Scheme, if I write this in foo.txt :

 (define z (* 3+2i 1+i)) ; notation a+bi
 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz

 I get this in foo.html (spaces missing) :

 (define z (* 3+2i 1+i)) ; notation a+bi
 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz

 franck


This applies to Python and all other languages equally, that's why I was
confused. I've fixed this issue and added utf-8, and moved the files to
a new location  also copied utils.py file which I forgot yesterday.


https://github.com/pythonbyexample/PBE/tree/master/jstmovie


 -m



--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

The world is a perpetual caricature of itself; at every moment it is the
mockery and the contradiction of what it is pretending to be.
George Santayana

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


Re: Uniquely identifying each every html template

2013-01-21 Thread Tom P

On 01/21/2013 01:39 PM, Oscar Benjamin wrote:

On 21 January 2013 12:06, Ferrous Cranus nikos.gr...@gmail.com wrote:

Τη Δευτέρα, 21 Ιανουαρίου 2013 11:31:24 π.μ. UTC+2, ο χρήστης Chris Angelico 
έγραψε:


Seriously, you're asking for something that's beyond the power of
humans or computers. You want to identify that something's the same
file, without tracking the change or having any identifiable tag.

That's a fundamentally impossible task.


No, it is difficult but not impossible.
It just cannot be done by tagging the file by:

1. filename
2. filepath
3. hash (math algorithm producing a string based on the file's contents)

We need another way to identify the file WITHOUT using the above attributes.


This is a very old problem (still unsolved I believe):
http://en.wikipedia.org/wiki/Ship_of_Theseus


Oscar

That wiki article gives a hint to a poosible solution -use a timestamp 
to determine which key is valid when.

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


Re: Windows subprocess.call problem

2013-01-21 Thread Tom Borkin
nob...@nowhere.com had an excellent suggestion that worked right off the
bat and achieved exactly what I was after. Thanks all!
Tom


On Mon, Jan 21, 2013 at 9:04 AM, Dave Angel d...@davea.name wrote:

 On 01/21/2013 06:25 AM, Tom Borkin wrote:

 Hi;
 I have this code:
 snip

 for song in my_songs:
subprocess.call(['notepad.exe'**, '%s.txt' % song])
print song

 It opens the first song and hangs on subsequent songs. It doesn't open the
 next song or execute the print until I have closed the first one. I want
 it
 to open all in the list, one after another, so I have all those songs
 available. Please advise.


 Why not just pass all the filenames as parameters in one invocation of
 notepad?  Assuming Notepad is written reasonably, that'll give it all to
 you in one window, instead of opening many separate ones.


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

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


Re: Windows subprocess.call problem

2013-01-21 Thread Terry Reedy

On 1/21/2013 6:22 PM, Tom Borkin wrote:

nob...@nowhere.com mailto:nob...@nowhere.com had an excellent
suggestion that worked right off the bat and achieved exactly what I was
after. Thanks all!


And what was it?



On Mon, Jan 21, 2013 at 9:04 AM, Dave Angel d...@davea.name
mailto:d...@davea.name wrote:

On 01/21/2013 06:25 AM, Tom Borkin wrote:

Hi;
I have this code:
snip

for song in my_songs:
subprocess.call(['notepad.exe'__, '%s.txt' % song])
print song

It opens the first song and hangs on subsequent songs. It
doesn't open the
next song or execute the print until I have closed the first
one. I want it
to open all in the list, one after another, so I have all those
songs
available. Please advise.


Why not just pass all the filenames as parameters in one invocation
of notepad?  Assuming Notepad is written reasonably, that'll give it
all to you in one window, instead of opening many separate ones.




--
Terry Jan Reedy

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


Re: Uniquely identifying each every html template

2013-01-21 Thread alex23
On Jan 22, 1:03 am, Ferrous Cranus nikos.gr...@gmail.com wrote:
 ALL, iam asking for is a way to make this work.

No, ALL you are asking is for us to take an _impossible_ situation and
make it magically work for you, without your having to improve your
understanding of the problem or modifying your requirements in any
way. You don't see *your ignorance* as the problem, preferring instead
to blame others and Python itself for your failings. None of the
solutions proposed satisfy you because they seem like too much work,
and you're convinced that this can just happen.

It can't, and you desperately need to educate yourself on some vital
aspects of _how the web works_ (and Python, and file systems, and *NIX
environments etc etc).

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


Re: Windows subprocess.call problem

2013-01-21 Thread Chris Angelico
On Tue, Jan 22, 2013 at 12:04 AM, Dave Angel d...@davea.name wrote:
 Why not just pass all the filenames as parameters in one invocation of
 notepad?  Assuming Notepad is written reasonably, that'll give it all to you
 in one window, instead of opening many separate ones.

The OP is talking about Windows Notepad. Assuming it to be, quote,
written reasonably, unquote, is like assuming that an elected
politician has a brain, or that a young child will like broccoli, or
that a post from 8 Dihedral will be useful and intelligible.

Also, I just tested Notepad, and if it's given multiple parameters, it
interprets them as a single filename with spaces in it (and then
offers to create that file). Was worth a try though.

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


Re: Uniquely identifying each every html template

2013-01-21 Thread alex23
On Jan 22, 1:07 am, Ferrous Cranus nikos.gr...@gmail.com wrote:
 Perhaps we should look into on how's the OS handles the file to get an idea 
 on how its done?

Who is this we you speak of? You mean you, right?

You do that and get back to us when you believe you've found something
that helps.

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


Re: Uniquely identifying each every html template

2013-01-21 Thread Oscar Benjamin
On 21 January 2013 23:01, Tom P werot...@freent.dd wrote:
 On 01/21/2013 01:39 PM, Oscar Benjamin wrote:

 On 21 January 2013 12:06, Ferrous Cranus nikos.gr...@gmail.com wrote:

 Τη Δευτέρα, 21 Ιανουαρίου 2013 11:31:24 π.μ. UTC+2, ο χρήστης Chris
 Angelico έγραψε:


 Seriously, you're asking for something that's beyond the power of
 humans or computers. You want to identify that something's the same
 file, without tracking the change or having any identifiable tag.

 That's a fundamentally impossible task.


 No, it is difficult but not impossible.
 It just cannot be done by tagging the file by:

 1. filename
 2. filepath
 3. hash (math algorithm producing a string based on the file's contents)

 We need another way to identify the file WITHOUT using the above
 attributes.


 This is a very old problem (still unsolved I believe):
 http://en.wikipedia.org/wiki/Ship_of_Theseus

 That wiki article gives a hint to a poosible solution -use a timestamp to
 determine which key is valid when.

In the Ship of Theseus, it is only argued that it is the same ship
because people were aware of the incremental changes that took place
along the way. The same applies here: if you don't track the
incremental changes and the two files have nothing concrete in common,
what does it mean to say that a file is the same file as some older
file?

That being said, I've always been impressed with the way that git can
understand when I think that a file is the same as some older file
(though it does sometimes go wrong):

~/tmp$ git init
Initialized empty Git repository in /home/oscar/tmp/.git/
~/tmp$ vim old.py
~/tmp$ cat old.py
#!/usr/bin/env python

print('This is a fairly useless script.')
print(Maybe I'll improve it later...)
~/tmp$ git add old.py
~/tmp$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use git rm --cached file... to unstage)
#
#   new file:   old.py
#
~/tmp$ git commit
[master (root-commit) 8e91665] First commit
 1 file changed, 4 insertions(+)
 create mode 100644 old.py
~/tmp$ ls
old.py
~/tmp$ cat old.py  new.py
~/tmp$ rm old.py
~/tmp$ vim new.py
~/tmp$ cat new.py
#!/usr/bin/env python

print('This is a fairly useless script.')
print(Maybe I'll improve it later...)

print(Although, I've edited it somewhat, it's still useless)
~/tmp$ git status
# On branch master
# Changes not staged for commit:
#   (use git add/rm file... to update what will be committed)
#   (use git checkout -- file... to discard changes in working directory)
#
#   deleted:old.py
#
# Untracked files:
#   (use git add file... to include in what will be committed)
#
#   new.py
no changes added to commit (use git add and/or git commit -a)
~/tmp$ git add -A .
~/tmp$ git status
# On branch master
# Changes to be committed:
#   (use git reset HEAD file... to unstage)
#
#   renamed:old.py - new.py
#

So it *is* Theseus' ship!


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


Re: Uniquely identifying each every html template

2013-01-21 Thread Chris Angelico
On Tue, Jan 22, 2013 at 10:43 AM, Oscar Benjamin
oscar.j.benja...@gmail.com wrote:
 On 21 January 2013 23:01, Tom P werot...@freent.dd wrote:
 On 01/21/2013 01:39 PM, Oscar Benjamin wrote:
 This is a very old problem (still unsolved I believe):
 http://en.wikipedia.org/wiki/Ship_of_Theseus

 That wiki article gives a hint to a poosible solution -use a timestamp to
 determine which key is valid when.

 In the Ship of Theseus, it is only argued that it is the same ship
 because people were aware of the incremental changes that took place
 along the way. The same applies here: if you don't track the
 incremental changes and the two files have nothing concrete in common,
 what does it mean to say that a file is the same file as some older
 file?

 That being said, I've always been impressed with the way that git can
 understand when I think that a file is the same as some older file
 (though it does sometimes go wrong):

Yeah, git's awesome like that :) It looks at file similarity, though,
so if you completely rewrite a file and simultaneously rename/move it,
git will lose track of it. And as you say, sometimes it gets things
wrong - if you merge a large file into a small one, git will report it
as a deletion and rename. (Of course, it doesn't make any difference.
It's just a matter of reporting.) Mercurial, if I understand
correctly, actually _tracks_ moves (and copies), but git just records
a deletion and a creation.

My family in fact has a literal grandfather's axe (except that I
don't think either of my grandfathers actually owned it, but it's my
Dad's old axe) that has had many new handles and a couple of new
heads. Bringing it back to computers, we have on our network two
computers Stanley and Ollie that have been there ever since we
first set up that network. Back then, it was coax cable, 10base2, no
routers/switches/etc, and the computers were I think early Pentiums.
We installed the database on one of them, and set the other in Dad's
office. Today, we have a modern Ethernet setup with modern hardware
and cat-5 cable; we still have Stanley with the database and Ollie in
the office. The name/identity of the computer is mostly associated
with its roles; but those roles can shift too (there was a time when
Ollie was the internet gateway, but that's no longer the case).
Identity is its own attribute.

The problem isn't that identity can't exist. It's that it can't be
discovered. That takes external knowledge. Dave's analogy is accurate.

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


Re: Sending a broadcast message using raw sockets

2013-01-21 Thread Peter Steele
On Monday, January 21, 2013 1:10:06 AM UTC-8, Rob Williscroft wrote:
 Peter Steele wrote in
 
 news:f37ccb35-8439-42cd-a063-962249b44...@googlegroups.com in
 
 comp.lang.python: 
 
  I want to write a program in Python that sends a broadcast message
  using raw sockets. The system where this program will run has no IP or
  default route defined, hence the reason I need to use a broadcast
  message. 
  
  I've done some searches and found some bits and pieces about using raw
  sockets in Python, but I haven't been able to find an example that
  explains how to construct a broadcast message using raw sockets. 
  
  Any pointers would be appreciated.
 
 This is part of my Wake-On-Lan script:
 
 def WOL_by_mac( mac, ip = 'broadcast', port = 9 ):
 
   import struct, socket
 
   a = mac.replace( ':', '-' ).split( '-' )
   addr = struct.pack( 'B'*6, *[ int(_, 16) for _ in a ] )
   msg = b'\xff' * 6 + addr * 16
 
   s = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
   s.setsockopt( socket.SOL_SOCKET, socket.SO_BROADCAST, 1 )
   s.sendto( msg, ( ip, port ) )
   s.close()
 
 The mac address is 6 pairs of hex digits seperated by '-' or ':'.

Thanks for the code sample. Does this code work if the box has no IP or default 
route assigned? I'm away from the office at the moment so I can't test this.
-- 
http://mail.python.org/mailman/listinfo/python-list


Storing class objects dynamically in an array

2013-01-21 Thread Brian D
Hi,

I'm trying to instantiate a class object repeated times, dynamically for as 
many times as are required, storing each class object in a container to later 
write out to a database. It kind of looks like what's needed is a 
two-dimensional class object, but I can't quite conceptualize how to do that. 

A simpler approach might be to just store class objects in a dictionary, using 
a reference value (or table row number/ID) as the key. 

In the real-world application, I'm parsing row, column values out of a table in 
a document which will have not more than about 20 rows, but I can't expect the 
document output to leave columns well-ordered. I want to be able to call the 
class objects by their respective row number.

A starter example follows, but it's clear that only the last instance of the 
class is stored. 

I'm not quite finding what I want from online searches, so what recommendations 
might Python users make for the best way to do this? 

Maybe I need to re-think the approach? 


Thanks,
Brian



class Car(object):

def __init__(self, Brand, Color, Condition):
self.Brand = Brand
self.Color = Color
self.Condition = Condition

brandList = ['Ford', 'Toyota', 'Fiat']
colorList = ['Red', 'Green', 'Yellow']
conditionList = ['Excellent', 'Good', 'Needs Help']

usedCarLot = {}

for c in range(0, len(brandList)):
print c, brandList[c]
usedCarLot[c] = Car
usedCarLot[c].Brand = brandList[c]
usedCarLot[c].Color = colorList[c]
usedCarLot[c].Condition = conditionList[c]

for k, v in usedCarLot.items():
print k, v.Brand, v.Color, v.Condition


 
0 Ford
1 Toyota
2 Fiat
0 Fiat Yellow Needs Help
1 Fiat Yellow Needs Help
2 Fiat Yellow Needs Help
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Storing class objects dynamically in an array

2013-01-21 Thread Dave Angel

On 01/21/2013 08:56 PM, Brian D wrote:

Hi,

I'm trying to instantiate a class object repeated times, dynamically for as 
many times as are required, storing each class object in a container to later 
write out to a database. It kind of looks like what's needed is a 
two-dimensional class object, but I can't quite conceptualize how to do that.

A simpler approach might be to just store class objects in a dictionary, using 
a reference value (or table row number/ID) as the key.

In the real-world application, I'm parsing row, column values out of a table in 
a document which will have not more than about 20 rows, but I can't expect the 
document output to leave columns well-ordered. I want to be able to call the 
class objects by their respective row number.

A starter example follows, but it's clear that only the last instance of the 
class is stored.

I'm not quite finding what I want from online searches, so what recommendations 
might Python users make for the best way to do this?

Maybe I need to re-think the approach?


Thanks,
Brian



class Car(object):

 def __init__(self, Brand, Color, Condition):
 self.Brand = Brand
 self.Color = Color
 self.Condition = Condition

brandList = ['Ford', 'Toyota', 'Fiat']
colorList = ['Red', 'Green', 'Yellow']
conditionList = ['Excellent', 'Good', 'Needs Help']

usedCarLot = {}

for c in range(0, len(brandList)):
 print c, brandList[c]
 usedCarLot[c] = Car


It'd work better if you actually instantiated Car, instead of just 
storing the class object multiple times.


Consider:
  usedCarLot[c] = Car(brandList[c], colorList[c], conditionList[c])



 usedCarLot[c].Brand = brandList[c]
 usedCarLot[c].Color = colorList[c]
 usedCarLot[c].Condition = conditionList[c]



Don't do those 3, since you already had to supply the values when 
constructing the object.




for k, v in usedCarLot.items():
 print k, v.Brand, v.Color, v.Condition





0 Ford
1 Toyota
2 Fiat
0 Fiat Yellow Needs Help
1 Fiat Yellow Needs Help
2 Fiat Yellow Needs Help



Next time, please supply the Python version, and state what you actually 
expected the output to represent.



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


Re: Storing class objects dynamically in an array

2013-01-21 Thread Dave Angel

On 01/21/2013 08:56 PM, Brian D wrote:

Hi,

I'm trying to instantiate a class object repeated times, dynamically for as 
many times as are required, storing each class object in a container to later 
write out to a database. It kind of looks like what's needed is a 
two-dimensional class object, but I can't quite conceptualize how to do that.

A simpler approach might be to just store class objects in a dictionary, using 
a reference value (or table row number/ID) as the key.

In the real-world application, I'm parsing row, column values out of a table in 
a document which will have not more than about 20 rows, but I can't expect the 
document output to leave columns well-ordered. I want to be able to call the 
class objects by their respective row number.

A starter example follows, but it's clear that only the last instance of the 
class is stored.

I'm not quite finding what I want from online searches, so what recommendations 
might Python users make for the best way to do this?

Maybe I need to re-think the approach?


Thanks,
Brian



class Car(object):

 def __init__(self, Brand, Color, Condition):
 self.Brand = Brand
 self.Color = Color
 self.Condition = Condition

brandList = ['Ford', 'Toyota', 'Fiat']
colorList = ['Red', 'Green', 'Yellow']
conditionList = ['Excellent', 'Good', 'Needs Help']

usedCarLot = {}

for c in range(0, len(brandList)):
 print c, brandList[c]
 usedCarLot[c] = Car
 usedCarLot[c].Brand = brandList[c]
 usedCarLot[c].Color = colorList[c]
 usedCarLot[c].Condition = conditionList[c]


Or even better:  (untested)

  for c, vals in enumerate(zip(brandList, colorList, conditionList)):
   usedCarLot[c] = Car(*vals)


for k, v in usedCarLot.items():
 print k, v.Brand, v.Color, v.Condition





0 Ford
1 Toyota
2 Fiat
0 Fiat Yellow Needs Help
1 Fiat Yellow Needs Help
2 Fiat Yellow Needs Help




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


Re: Storing class objects dynamically in an array

2013-01-21 Thread MRAB

On 2013-01-22 01:56, Brian D wrote:

Hi,

I'm trying to instantiate a class object repeated times, dynamically for as 
many times as are required, storing each class object in a container to later 
write out to a database. It kind of looks like what's needed is a 
two-dimensional class object, but I can't quite conceptualize how to do that.

A simpler approach might be to just store class objects in a dictionary, using 
a reference value (or table row number/ID) as the key.

In the real-world application, I'm parsing row, column values out of a table in 
a document which will have not more than about 20 rows, but I can't expect the 
document output to leave columns well-ordered. I want to be able to call the 
class objects by their respective row number.

A starter example follows, but it's clear that only the last instance of the 
class is stored.

I'm not quite finding what I want from online searches, so what recommendations 
might Python users make for the best way to do this?

Maybe I need to re-think the approach?


Thanks,
Brian



class Car(object):

 def __init__(self, Brand, Color, Condition):
 self.Brand = Brand
 self.Color = Color
 self.Condition = Condition

brandList = ['Ford', 'Toyota', 'Fiat']
colorList = ['Red', 'Green', 'Yellow']
conditionList = ['Excellent', 'Good', 'Needs Help']

usedCarLot = {}

for c in range(0, len(brandList)):
 print c, brandList[c]
 usedCarLot[c] = Car
 usedCarLot[c].Brand = brandList[c]
 usedCarLot[c].Color = colorList[c]
 usedCarLot[c].Condition = conditionList[c]

for k, v in usedCarLot.items():
 print k, v.Brand, v.Color, v.Condition





0 Ford
1 Toyota
2 Fiat
0 Fiat Yellow Needs Help
1 Fiat Yellow Needs Help
2 Fiat Yellow Needs Help


You're repeatedly putting the class itself in the dict and setting its
(the class's) attributes; you're not even using the __init__ method you
defined.

What you should be doing is creating instances of the class:

for c in range(len(brandList)):
print c, brandList[c]
usedCarLot[c] = Car(brandList[c], colorList[c], conditionList[c])

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


Re: Uniquely identifying each every html template

2013-01-21 Thread rusi
On Jan 21, 5:55 pm, alex23 wuwe...@gmail.com wrote:
 On Jan 21, 10:39 pm, Oscar Benjamin oscar.j.benja...@gmail.com
 wrote:

  This is a very old problem (still unsolved I 
  believe):http://en.wikipedia.org/wiki/Ship_of_Theseus

 +1 internets for referencing my most favourite thought experiment
 ever :)

+2 Oscar for giving me this name.

A more apposite (to computers) experience:

Ive a computer whose OS I wanted to upgrade without disturbing the
existing setup. Decided to fit a new hard disk with a new OS.
Installed the OS on a new hard disk, fitted the new hard disk into the
old computer and rebooted.

The messages that started coming were: New Hardware detected: monitor,
mouse, network card etc etc. but not new disk!

Strange! The only one thing new is not seen as new but all the old
things are seen as new.


So…
Ask a layman whats a computer and he'll point to the box and call it
'CPU'.
Ask a more computer literate person and he'll point to the chip inside
the box and say 'CPU'
Ask the computer itself and it says 'Disk'.

Moral:
Object identity is at best hard -- usually unsolvable
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Storing class objects dynamically in an array

2013-01-21 Thread Brian D
On Monday, January 21, 2013 8:29:50 PM UTC-6, MRAB wrote:
 On 2013-01-22 01:56, Brian D wrote:
 
  Hi,
 
 
 
  I'm trying to instantiate a class object repeated times, dynamically for as 
  many times as are required, storing each class object in a container to 
  later write out to a database. It kind of looks like what's needed is a 
  two-dimensional class object, but I can't quite conceptualize how to do 
  that.
 
 
 
  A simpler approach might be to just store class objects in a dictionary, 
  using a reference value (or table row number/ID) as the key.
 
 
 
  In the real-world application, I'm parsing row, column values out of a 
  table in a document which will have not more than about 20 rows, but I 
  can't expect the document output to leave columns well-ordered. I want to 
  be able to call the class objects by their respective row number.
 
 
 
  A starter example follows, but it's clear that only the last instance of 
  the class is stored.
 
 
 
  I'm not quite finding what I want from online searches, so what 
  recommendations might Python users make for the best way to do this?
 
 
 
  Maybe I need to re-think the approach?
 
 
 
 
 
  Thanks,
 
  Brian
 
 
 
 
 
 
 
  class Car(object):
 
 
 
   def __init__(self, Brand, Color, Condition):
 
   self.Brand = Brand
 
   self.Color = Color
 
   self.Condition = Condition
 
 
 
  brandList = ['Ford', 'Toyota', 'Fiat']
 
  colorList = ['Red', 'Green', 'Yellow']
 
  conditionList = ['Excellent', 'Good', 'Needs Help']
 
 
 
  usedCarLot = {}
 
 
 
  for c in range(0, len(brandList)):
 
   print c, brandList[c]
 
   usedCarLot[c] = Car
 
   usedCarLot[c].Brand = brandList[c]
 
   usedCarLot[c].Color = colorList[c]
 
   usedCarLot[c].Condition = conditionList[c]
 
 
 
  for k, v in usedCarLot.items():
 
   print k, v.Brand, v.Color, v.Condition
 
 
 
 
 
 
 
  0 Ford
 
  1 Toyota
 
  2 Fiat
 
  0 Fiat Yellow Needs Help
 
  1 Fiat Yellow Needs Help
 
  2 Fiat Yellow Needs Help
 
 
 
 You're repeatedly putting the class itself in the dict and setting its
 
 (the class's) attributes; you're not even using the __init__ method you
 
 defined.
 
 
 
 What you should be doing is creating instances of the class:
 
 
 
 for c in range(len(brandList)):
 
  print c, brandList[c]
 
  usedCarLot[c] = Car(brandList[c], colorList[c], conditionList[c])

Thanks for the quick reply Dave  MRAB. I wasn't even sure it could be done, so 
missing the instantiation just completely slipped. 

The simplest fix is as follows, but Dave, I'll try to tighten it up a little, 
when I turn to the real-world code, following your enumeration example. And 
yes, thanks for the reminder (2.7.3). The output is fine -- I just need a 
record number and the list of values stored in the class object.

This is the quick fix -- instantiate class Car: 

usedCarLot[c] = Car('','','')

It may not, however, be the best, most Pythonic way.

Here's the full implementation. I hope this helps someone else. 

Thanks very much for the help!

class Car(object):

def __init__(self, Brand, Color, Condition):
self.Brand = Brand
self.Color = Color
self.Condition = Condition

brandList = ['Ford', 'Toyota', 'Fiat']
colorList = ['Red', 'Green', 'Yellow']
conditionList = ['Excellent', 'Good', 'Needs Help']

#usedCarLot = {0:Car, 1:Car, 2:Car}
usedCarLot = {}

for c in range(0, len(brandList)):
#print c, brandList[c]
usedCarLot[c] = Car('','','')
usedCarLot[c].Brand = brandList[c]
usedCarLot[c].Color = colorList[c]
usedCarLot[c].Condition = conditionList[c]

for k, v in usedCarLot.items():
print k, v.Brand, v.Color, v.Condition
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Uniquely identifying each every html template

2013-01-21 Thread Tim Roberts
Ferrous Cranus nikos.gr...@gmail.com wrote:

No, it is difficult but not impossible.
It just cannot be done by tagging the file by:

1. filename
2. filepath
3. hash (math algorithm producing a string based on the file's contents)

We need another way to identify the file WITHOUT using the above attributes.

Think about it this way.  Say that YOU, as a human being, were inserted
into the web server.  You are handed the path and the contents of a page
about to be served.  How would YOU solve this problem?

If you can't describe in words how YOU would recognize these altered files,
then there is absolutely no way to teach a computer how to do it.  It IS
impossible.
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Uniquely identifying each every html template

2013-01-21 Thread Tim Roberts
Ferrous Cranus nikos.gr...@gmail.com wrote:

Renames and  moves are performed, either by shell access or either by cPanel 
access by website owners.

That being said i have no control on HOW and WHEN users alter their html pages.

Right, and that makes it impossible to solve this problem.

Think about some scenarios.  Let's say I have a web site with two pages:
~/web/page1.html
~/web/page2.html

Now let's say I use some editor to make a copy of page1 called page1a.html.
~/web/page1.html
~/web/page1a.html
~/web/page2.html

Should page1a.html be considered the same page as page1.html?  What if I
subsequently delete page1.html?  What if I don't?  How long will you wait
before deciding they are the same?
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Uniquely identifying each every html template

2013-01-21 Thread rusi
On Jan 21, 8:07 pm, Ferrous Cranus nikos.gr...@gmail.com wrote:
 Τη Δευτέρα, 21 Ιανουαρίου 2013 9:20:15 π.μ. UTC+2, ο χρήστης Chris Angelico 
 έγραψε:









  On Mon, Jan 21, 2013 at 6:08 PM, Ferrous Cranus nikos.gr...@gmail.com 
  wrote:

   An .html page must retain its database counter value even if its:

   (renamed  moved  contents altered)

  Then you either need to tag them in some external way, or have some

  kind of tracking operation - for instance, if you require that all

  renames/moves be done through a script, that script can update its

  pointer. Otherwise, you need magic, and lots of it.

  ChrisA

 Perhaps we should look into on how's the OS handles the file to get an idea 
 on how its done?

Yes…
Perhaps the most useful for you suggestion Ive seen in this thread is
to look at git.
If you do you will find that
a. git has to do a great deal more work than you expect to factorize
out content-tracking from file-tracking
b. Yet it can get it wrong

Look at
snapshoting file systems 
http://en.wikipedia.org/wiki/Snapshot_%28computer_storage%29#File_systems
like winfs (cancelled) and btrfs
Slightly more practical may be timevault 
http://www.dedoimedo.com/computers/timevault.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Uniquely identifying each every html template

2013-01-21 Thread Chris Angelico
On Tue, Jan 22, 2013 at 2:24 PM, rusi rustompm...@gmail.com wrote:
 Ive a computer whose OS I wanted to upgrade without disturbing the
 existing setup. Decided to fit a new hard disk with a new OS.
 Installed the OS on a new hard disk, fitted the new hard disk into the
 old computer and rebooted.

 The messages that started coming were: New Hardware detected: monitor,
 mouse, network card etc etc. but not new disk!

 Strange! The only one thing new is not seen as new but all the old
 things are seen as new.

That's because you asked the OS to look at the computer, and the OS
was on the disk. So in that sense, you did give it a whole lot of new
hardware but not a new disk. However, Windows Product Activation would
probably have called that a new computer, meaning that Microsoft deems
it to be new. (I've no idea about other non-free systems. Free systems
don't care about new computer vs same computer, of course.)

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


pycache directories

2013-01-21 Thread monosij . forums
I am doing some OO python3 where I am using multiple dirs/sub-dirs.

So everything works fine, however when I run code __pycache__ directories are 
being created in every directory touched by the execution.

Is it possible to set a configuration to be able to create these pycache 
directories in a specific location?

Coming from the Java world - am used to the /src, /bin aspects - so somewhat 
prefer the 'executables' out of the way.

I am using python3 on Ubuntu so wondering if there is some environ setting?

Thanks for your help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pycache directories

2013-01-21 Thread Terry Reedy

On 1/21/2013 11:55 PM, monosij.for...@gmail.com wrote:

I am doing some OO python3 where I am using multiple dirs/sub-dirs.

So everything works fine, however when I run code __pycache__
directories are being created in every directory touched by the
execution.


This is much better than having multiple .pyc files in every directory, 
as in Py2. You should soon learn to ignore them.



Is it possible to set a configuration to be able to create these
pycache directories in a specific location?


No. (I am very sure.) You can however, not have the .pyc files written, 
but that means recompile with every run. So that option is meant for 
running off a read-only medium.


--
Terry Jan Reedy

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


Re: Uniquely identifying each every html template

2013-01-21 Thread Ferrous Cranus
Τη Δευτέρα, 21 Ιανουαρίου 2013 10:48:11 μ.μ. UTC+2, ο χρήστης Piet van Oostrum 
έγραψε:
 Ferrous Cranus nikos.gr...@gmail.com writes:
 
 
 
  This python script acts upon websites other people use and every html
 
  templates has been written by different methods(notepad++,
 
  dreamweaver, joomla).
 
 
 
  Renames and moves are performed, either by shell access or either by
 
  cPanel access by website owners.
 
 
 
  That being said i have no control on HOW and WHEN users alter their html 
  pages.
 
 
 
 Under these circumstances the only way to solve it is to put an
 
 identification *inside* the file and make sure it will not be changed.
 
 It could for example be some invisible piece of HTML, or an attribute to
 
 some tag. If that can't be done the problem cannot be solved and it
 
 makes no sense keeping asking the same question over and over again.

The solution you propose is what i already use for my website.
Since its my website i can edit all the .html i want embedding a unique number 
in each and evey one of them as i showed in my initial post.

Problem is i'am not allowed to do the same with the other websites i host.
And apart from that even if i was allowed to, an html page could be rewritten 
thus the identified would get lost.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Uniquely identifying each every html template

2013-01-21 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 6:04:09 π.μ. UTC+2, ο χρήστης Tim Roberts έγραψε:
 Ferrous Cranus nikos.gr...@gmail.com wrote:
 
 
 
 Renames and  moves are performed, either by shell access or either by cPanel 
 access by website owners.
 
 
 
 That being said i have no control on HOW and WHEN users alter their html 
 pages.
 
 
 
 Right, and that makes it impossible to solve this problem.
 
 
 
 Think about some scenarios.  Let's say I have a web site with two pages:
 
 ~/web/page1.html
 
 ~/web/page2.html
 
 
 
 Now let's say I use some editor to make a copy of page1 called page1a.html.
 
 ~/web/page1.html
 
 ~/web/page1a.html
 
 ~/web/page2.html
 
 
 
 Should page1a.html be considered the same page as page1.html?  What if I
 
 subsequently delete page1.html?  What if I don't?  How long will you wait
 
 before deciding they are the same?
 
 -- 
 
 Tim Roberts, t...@probo.com
 
 Providenza  Boekelheide, Inc.

You are right, it cannot be done.

So i have 2 options .

Either identify an .html file from its filepath or from its hash.

Which method do you advice me to utilize?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why not?

2013-01-21 Thread Josh Benner
On Mon, Jan 21, 2013 at 7:56 AM, Lie Ryan lie.1...@gmail.com wrote:

 On 22/01/13 04:02, kwakukwat...@gmail.com wrote:

 f = open(r'c:\text\somefile.txt')
 for i in range(3):
 print str(i) + ': ' + f.readline(),
 please with the print str(i) + ‘: ‘ + f.readline(), why not print str(i)
 + f.readline(),


 Try running both code. What do you see? What's the difference? When do you
 think you might want one or the other?
 --
 http://mail.python.org/**mailman/listinfo/python-listhttp://mail.python.org/mailman/listinfo/python-list



There is nothing 'wrong' with either print statement.  The why or why not,
depends on the requirements of who or what intends to 'consume' the output.
 In other words, what problem does this code solve?  Think about which
print statement produces the best output for that problem.

It is also always a good idea to close the file object when you are done
with it.  Consider executing file operations inside a 'with' block.

with open(r'c:\text\somefile.txt') as f:
for i in range(3):
print str(i) + ': ' + f.readline()


The above code can be generalized further for use with text files that
contain a variable number of lines.

with open(r'c:\text\somefile.txt') as f:
for index, line in enumerate( f ):
print str( index ) + ': ' + f.readline()
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue17006] Warn users about hashing secrets?

2013-01-21 Thread Christian Heimes

New submission from Christian Heimes:

Lot's of people still think that something like sha512(secret + message), 
sha1(password + salt) or even sha1(password) is secure. Except it isn't. Most 
crypto hash functions like md5, sha1, sha2 family (sha256, sha384, sha512) use 
a Merkle–Damgård construction [1]. The construction is vulnerable to several 
attack vectors like length extension attacks. Passwords needs special care, too.

I propose we add a warning to the documentation of hashlib. It's not the right 
place to teach cryptographics but it's a good place to raise attention. The 
warning should explain that you shouldn't solely hash secrets or messages 
containing a secret. For messages a MAC algorithm like HMAC should be used. For 
passwords a key stretching and key derivation function like PBKDF2, bcrypt or 
scrypt is much more secure.

[1] http://en.wikipedia.org/wiki/Merkle%E2%80%93Damg%C3%A5rd_construction

--
assignee: docs@python
components: Documentation
messages: 180330
nosy: christian.heimes, docs@python
priority: normal
severity: normal
status: open
title: Warn users about hashing secrets?
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue17006] Warn users about hashing secrets?

2013-01-21 Thread Hynek Schlawack

Hynek Schlawack added the comment:

I think since we ship cryptographic functions, we should take responsibility 
and warn against the most common mistakes people do.

--
nosy: +hynek

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



[issue17006] Warn users about hashing secrets?

2013-01-21 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti
stage:  - needs patch

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



[issue16335] Integer overflow in unicode-escape decoder

2013-01-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7625866f8127 by Serhiy Storchaka in branch '3.2':
Issue #16335: Fix integer overflow in unicode-escape decoder.
http://hg.python.org/cpython/rev/7625866f8127

New changeset 494d341e9143 by Serhiy Storchaka in branch '3.3':
Issue #16335: Fix integer overflow in unicode-escape decoder.
http://hg.python.org/cpython/rev/494d341e9143

New changeset 8488febf7d79 by Serhiy Storchaka in branch 'default':
Issue #16335: Fix integer overflow in unicode-escape decoder.
http://hg.python.org/cpython/rev/8488febf7d79

--
nosy: +python-dev

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



[issue16335] Integer overflow in unicode-escape decoder

2013-01-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f4d30d1a529e by Serhiy Storchaka in branch '2.7':
Issue #16335: Fix integer overflow in unicode-escape decoder.
http://hg.python.org/cpython/rev/f4d30d1a529e

--

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



[issue16335] Integer overflow in unicode-escape decoder

2013-01-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I rewrote the test in EAFP style.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue16957] shutil.which() shouldn't look in working directory on unix-y systems

2013-01-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--

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



[issue16335] Integer overflow in unicode-escape decoder

2013-01-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f84a6c89ccbc by Serhiy Storchaka in branch '3.2':
Fix memory error in test_ucn.
http://hg.python.org/cpython/rev/f84a6c89ccbc

New changeset 7c2aae472b27 by Serhiy Storchaka in branch '3.3':
Fix memory error in test_ucn.
http://hg.python.org/cpython/rev/7c2aae472b27

New changeset f90d6ce49772 by Serhiy Storchaka in branch 'default':
Fix memory error in test_ucn.
http://hg.python.org/cpython/rev/f90d6ce49772

New changeset 38a10d0778d2 by Serhiy Storchaka in branch '2.7':
Fix memory error in test_ucn.
http://hg.python.org/cpython/rev/38a10d0778d2

--

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



[issue17006] Warn users about hashing secrets?

2013-01-21 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue16038] ftplib: unlimited readline() from connection

2013-01-21 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue16042] smtplib: unlimited readline() from connection

2013-01-21 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue16039] imaplib: unlimited readline() from connection

2013-01-21 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue16040] nntplib: unlimited readline() from connection

2013-01-21 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue16041] poplib: unlimited readline() from connection

2013-01-21 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue16822] execv (et al.) should invoke atexit handlers before executing new code

2013-01-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I agree with Charles-François, this is a too risky change.
However, we could definitely have a separate atexec handler, like the 
atfork handlers which are proposed in issue16500.

--

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



[issue16993] shutil.which() should preserve path case

2013-01-21 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka

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



  1   2   >