Python newbie data structures question

2009-10-28 Thread codingJoe
Hi all! I am trying to choose the right data structure to do a value lookup with multiple keys. I want to lookup data by: key, key,{ values } My final product should be able to reference this datastructure from within a django template. Because my lookup needs only 80 values and will never c

Re: Copying a ZipExtFile

2009-10-28 Thread ryles
On Oct 28, 8:33 pm, ryles wrote: > As for why the bytesToRead calculation in ZipExtFile.read() results in > a long, I've not yet looked at it closely. Simple, actually: In ZipExtFile.__init__(): self.bytes_read = 0L In ZipExitFile.read(): bytesToRead = self.compress_size - self.bytes_

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Gabriel Genellina
En Wed, 28 Oct 2009 21:06:03 -0300, Alf P. Steinbach escribió: The installer did manage to do the rest of that part correctly: file associations and PATHEXT variable. The Python installer from python.org does NOT add .py and .pyw to PATHEXT; the ActivePython one does. (3) Tkinter not

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Alf P. Steinbach
* John Machin: On Oct 29, 11:06 am, "Alf P. Steinbach" wrote: (3) Tkinter not bundled, misleading & incomplete documentation. With the file associations in place (the installer managed to do that) running console programs works fine. However, running Tkinter based programs does *not* work:

Re: What exception shall I raise when os.path.exists fails?

2009-10-28 Thread Chris Rebert
On Wed, Oct 28, 2009 at 10:01 PM, Peng Yu wrote: > I want to raise an exception when os.path.exists fails. I looked > through the exception list on the menu. I'm not sure if IOError is the > most appropriate exception I should use. Could somebody let me know? Yeah, I'd say IOError: Python 2.6.2

What exception shall I raise when os.path.exists fails?

2009-10-28 Thread Peng Yu
I want to raise an exception when os.path.exists fails. I looked through the exception list on the menu. I'm not sure if IOError is the most appropriate exception I should use. Could somebody let me know? Thank you! import os.path def direct_target(path): while os.path.islink(path): path =

Newbie advice

2009-10-28 Thread CSharpner
Alright, I'm not new to programming, but I'm diving in head first into Python for the first time. I'm running on Windows 7, just installed "Eclipse Java EE IDE for Web Developers" and installed PyDev in it and installed Python 2.6. I've written my first "Hello World" program, which simply display

Re: What IDE has good git and python support?

2009-10-28 Thread alex23
On Oct 28, 1:56 am, Aweks wrote: > what do you use? ActiveState's Komodo IDE. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread John Machin
On Oct 29, 11:06 am, "Alf P. Steinbach" wrote: > (3) Tkinter not bundled, misleading & incomplete documentation. > > With the file associations in place (the installer managed to do that) running > console programs works fine. > > However, running Tkinter based programs does *not* work: > > > imp

Re: a simple unicode question

2009-10-28 Thread Tim Arnold
"Chris Jones" wrote in message news:mailman.2149.1256707687.2807.python-l...@python.org... > On Tue, Oct 27, 2009 at 06:21:11AM EDT, Lie Ryan wrote: >> Chris Jones wrote: > > [..] > >>> Best part of Unicode is that there are multiple encodings, right? ;-) >> >> No, the best part about Unicode is

Re: calling server side function

2009-10-28 Thread Tim Arnold
"Gabriel Genellina" wrote in message news:mailman.2155.1256716617.2807.python-l...@python.org... > En Wed, 28 Oct 2009 04:04:50 -0300, Paul Hartley > escribió: > >> I have a socket set up between a client and server program. Let's say >> that I serialize (pickle) some data in the client and s

Re: How to test if a file is a symbolic link?

2009-10-28 Thread Ben Finney
Peng Yu writes: > 'symbolic_link' is a symbolic link in the current directory. I run > 'python main.py', but it does not return me anything. I want to check > if a file is a symbolic link. You have the same access to the Python help as we do: >>> import os.path >>> help(os.path) You ha

Re: How to test if a file is a symbolic link?

2009-10-28 Thread ma
import os if os.path.islink('symbolic_link'): print "hello." Cheers, Mahmoud Abdelkader On Oct 28, 2009, at 11:19 PM, Peng Yu wrote: 'symbolic_link' is a symbolic link in the current directory. I run 'python main.py', but it does not return me anything. I want to check if a file is a sym

Fix problems with email list

2009-10-28 Thread Spencer Heckathorn
I am getting doubles of every email on this list. Is there a list manager I can inform? Please help this is getting very annoying and makes it very hard to follow along. Spencer -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if a file is a symbolic link?

2009-10-28 Thread Steven D'Aprano
On Wed, 28 Oct 2009 22:19:55 -0500, Peng Yu wrote: > 'symbolic_link' is a symbolic link in the current directory. I run > 'python main.py', but it does not return me anything. I want to check if > a file is a symbolic link. I'm wondering what is the correct way to do > so? > > $cat main.py > impo

Re: How to test if a file is a symbolic link?

2009-10-28 Thread tec
On 2009-10-29 11:19, Peng Yu wrote: 'symbolic_link' is a symbolic link in the current directory. I run 'python main.py', but it does not return me anything. I want to check if a file is a symbolic link. I'm wondering what is the correct way to do so? $cat main.py import stat import os st = os.s

Re: How to test if a file is a symbolic link?

2009-10-28 Thread D'Arcy J.M. Cain
On Wed, 28 Oct 2009 22:19:55 -0500 Peng Yu wrote: > 'symbolic_link' is a symbolic link in the current directory. I run > 'python main.py', but it does not return me anything. I want to check > if a file is a symbolic link. I'm wondering what is the correct way to > do so? > > $cat main.py > impor

Minifb 1.2 released

2009-10-28 Thread peteshinners
I've released version 1.2 of my simple Facebook module, minifb. http://code.google.com/p/minifb/ This is a minimalist API for validating and making calls to Facebook. The new release fixes a few outstanding problems, and adds support for Python 3. Because the module isn't too large, writing it in

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Richard Heathfield
In , Dann Corbit wrote: > > You can read PDF with the ghostscript stuff or the free Adobe stuff. Agreed. But why should you have to? > A man who cannot read .pdf or .ps in today's computer science world > is a crippled man (IMO-YMMV). A man who doesn't particularly enjoy relying on proprieta

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Richard Heathfield
In , Dann Corbit wrote: > In article , al...@start.no > says... >> >> here's the public view of ch 1 >> (complete) and ch 2 (about one third completed, I've not yet >> settled on a title so it's just chapter "asd"): >> >> http://preview.tinyurl.com/progintro >> >> Cheers, > > Why is c

How to test if a file is a symbolic link?

2009-10-28 Thread Peng Yu
'symbolic_link' is a symbolic link in the current directory. I run 'python main.py', but it does not return me anything. I want to check if a file is a symbolic link. I'm wondering what is the correct way to do so? $cat main.py import stat import os st = os.stat('symbolic_link') if stat.S_ISLNK(s

Re: __eq__() inconvenience when subclassing set

2009-10-28 Thread Mick Krippendorf
Jess Austin schrieb: > >>> frozenset([1]) == mySet() > False > > frozenset doesn't use mySet.__eq__() because mySet is not a subclass > of frozenset as it is for set. You could just overwrite set and frozenset: class eqmixin(object): def __eq__(self, other): print "called %s.__eq__()

Re: Working threads progress

2009-10-28 Thread ryles
On Oct 28, 7:02 pm, mattia wrote: > Now, I would like to know the activity done (e.g. every two seconds) so I > create another thread that checks the queue size (using .qsize()). Have > you any suggestion to improve the code? It's not uncommon to pass each thread a second queue for output, which

Re: Building Python on Solaris 10?

2009-10-28 Thread ryles
On Oct 28, 3:46 pm, Judy Booth wrote: > Can anyone point me towards some instructions for building Python on > Solaris 10? > We need this for some of our test scripts and so far we cannot get this > to build. > > We have tried both Python 2.6.4 and 3.1.1 and both fail with messages > like this: >

cool-compiling python 3

2009-10-28 Thread Rustom Mody
I guess this is a bit OT but anyhow. I just finished compiling compiling python 3 on ubuntu and discovered that my laptop has a builtin toaster :-; Yeah I know this is not a python issue and probably modern laptops are meant to run wondrous beautiful elephantaneous things like eclipse coo

__eq__() inconvenience when subclassing set

2009-10-28 Thread Jess Austin
I'm subclassing set, and redefining __eq__(). I'd appreciate any relevant advice. >>> class mySet(set): ... def __eq__(self, other): ... print "called mySet.__eq__()!" ... if isinstance(other, (set, frozenset)): ... return True ... return set.__eq__(self, o

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread John Machin
On Oct 29, 11:56 am, "Alf P. Steinbach" wrote: > Summarizing the main differences 2.6 -> 3.1.1 that I know of so far: print is > now a function (nice), "/" now always produces float result (unsure about > that, > it must surely break a lot or even most of existing code?), xrange() has been > remo

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Alf P. Steinbach
* David Robinow: On Wed, Oct 28, 2009 at 8:06 PM, Alf P. Steinbach wrote: PS: This was not unexpected. It was exactly why I earlier didn't even look at CPython (umpteen bad experiences with *nix ports) but used ActivePython. It's not a *nix port. It's multiplatform and it works fine. Your "

Re: popen function of os and subprocess modules

2009-10-28 Thread Sean DiZazzo
On Oct 28, 7:15 am, banu wrote: > On Oct 28, 3:02 pm, Jon Clements wrote: > > > > > On 28 Oct, 13:39, banu wrote: > > > > Hi, > > > I am a novice in python. I was trying to write a simple script on > > > Linux (python 3.0) that does the following > > > > #cd directory > > > #ls -l > > > > I use

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread David Robinow
On Wed, Oct 28, 2009 at 8:06 PM, Alf P. Steinbach wrote: > PS: This was not unexpected. It was exactly why I earlier didn't even look > at CPython (umpteen bad experiences with *nix ports) but used ActivePython. It's not a *nix port. It's multiplatform and it works fine. As you've been told befor

Re: Python 2.6 Global Variables

2009-10-28 Thread Benjamin Kaplan
On Wed, Oct 28, 2009 at 8:50 PM, mattofak wrote: > Hi All; > > I'm new to Python and moving from C, which is probably a big source of > my confusion. I'm struggling with something right now though and I > hope you all can help. > > I have a global configuration that I would like all my classes and

Re: Form Parsing resouces

2009-10-28 Thread Tim Johnson
On 2009-10-28, Gabriel Genellina wrote: <...> > Try FormEncode http://formencode.org/ Wish I had noticed that yesterday. I started "rolling my own" and am about 2/3's way thru. thanks -- Tim t...@johnsons-web.com http://www.akwebsoft.com -- http://mail.python.org/mailman/listinfo/py

Re: Python 2.6 Global Variables

2009-10-28 Thread Chris Rebert
> On Oct 28, 2009, at 20:50, mattofak wrote: >> Hi All; >> >> I'm new to Python and moving from C, which is probably a big source of >> my confusion. I'm struggling with something right now though and I >> hope you all can help. >> >> I have a global configuration that I would like all my classes

Re: Python 2.6 Global Variables

2009-10-28 Thread Ronn Ross
Inside the method that you want to use the var prefix the first instance with global. For example: global my_var. Then you can use the var like normal in the method. Good luck On Oct 28, 2009, at 20:50, mattofak wrote: Hi All; I'm new to Python and moving from C, which is probably a big

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Alf P. Steinbach
* Mark Hammond: On 29/10/2009 11:06 AM, Alf P. Steinbach wrote: So I suggest switching to some other more light-weight installer technology. Thanks for the suggestion, but I expect we will stick with MSI even with its shortcomings. Using MSI files has significant other advantages, particul

Re: Web development with Python 3.1

2009-10-28 Thread Alan Harris-Reid
Martin v. Löwis wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of you shouting "don't - start with 2.6"), but as far as I can see, none of the popular python-to-web frameworks (Django, CherryPy, web

Python 2.6 Global Variables

2009-10-28 Thread mattofak
Hi All; I'm new to Python and moving from C, which is probably a big source of my confusion. I'm struggling with something right now though and I hope you all can help. I have a global configuration that I would like all my classes and modules to be able to access. What is the correct way to do t

Re: Re: Web development with Python 3.1

2009-10-28 Thread Alan Harris-Reid
John Nagle wrote: Alan Harris-Reid wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 Until MySQLdb gets ported to something later than Python 2.5, support for a "data-based web site" probably has to be in Python

Re: Copying a ZipExtFile

2009-10-28 Thread ryles
On Oct 23, 1:15 pm, "Moore, Mathew L" wrote: > Hello all, > > A newbie here.  I was wondering why the following fails on Python 2.6.2 > (r262:71605) on win32.  Am I doing something inappropriate? > > Interestingly, it works in 3.1, but would like to also get it working in 2.6. > > Thanks in advan

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Mark Hammond
On 29/10/2009 11:06 AM, Alf P. Steinbach wrote: So I suggest switching to some other more light-weight installer technology. Thanks for the suggestion, but I expect we will stick with MSI even with its shortcomings. Using MSI files has significant other advantages, particularly in "managed"

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Alf P. Steinbach
* Gabriel Genellina: En Wed, 28 Oct 2009 19:18:48 -0300, Alf P. Steinbach escribió: I thought it would be prudent to install 3.1.1 for Windows from scratch, so I uninstalled everything (CPython, ActivePython), and then installed Python 3.1.1. In the "Advanced" option I told the installer to

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Alf P. Steinbach
* Gabriel Genellina: En Wed, 28 Oct 2009 19:30:13 -0300, Alf P. Steinbach escribió: Hm, the installer forgot to clean up, leaving lots of files, so contrary to the dialog's final message the system had been modified. If those files are third-party libraries, this confirms my previous post.

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Alf P. Steinbach
* Alf P. Steinbach: * Alf P. Steinbach: Hi. Or, to whomever this concerns... ;-) I thought it would be prudent to install 3.1.1 for Windows from scratch, so I uninstalled everything (CPython, ActivePython), and then installed Python 3.1.1. In the "Advanced" option I told the installer to

Re: Web development with Python 3.1

2009-10-28 Thread Rhodri James
On Wed, 28 Oct 2009 07:08:12 -, John Nagle wrote: Alan Harris-Reid wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 Until MySQLdb gets ported to something later than Python 2.5, support for a "data-based w

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Gabriel Genellina
En Wed, 28 Oct 2009 08:49:02 -0300, Alf P. Steinbach escribió: I suggested ActiveState because I know from earlier that their packages are easy to install and provide documentation in reasonable Windows CHM help file format. I did try the IronPython .NET implementation first :-). But my

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Gabriel Genellina
En Wed, 28 Oct 2009 19:30:13 -0300, Alf P. Steinbach escribió: Hm, the installer forgot to clean up, leaving lots of files, so contrary to the dialog's final message the system had been modified. If those files are third-party libraries, this confirms my previous post. It's not the 3.1.1

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Gabriel Genellina
En Wed, 28 Oct 2009 19:18:48 -0300, Alf P. Steinbach escribió: I thought it would be prudent to install 3.1.1 for Windows from scratch, so I uninstalled everything (CPython, ActivePython), and then installed Python 3.1.1. In the "Advanced" option I told the installer to compile packages.

Re: ConfigParser.items sorting

2009-10-28 Thread Dean McClure
On Oct 29, 9:05 am, Jon Clements wrote: > On 28 Oct, 21:55, Dean McClure wrote: > > > > > > > On Oct 28, 4:50 pm, Jon Clements wrote: > > > > On 28 Oct, 06:21, Dean McClure wrote: > > > > > Hi, > > > > > Just wondering how I can get theitems() command fromConfigParserto > > > > not resort all t

Re: popen function of os and subprocess modules

2009-10-28 Thread Albert Hopkins
On Wed, 2009-10-28 at 07:15 -0700, banu wrote: > > Thanks for the reply Jon > Basically I need to move into a folder and then need to execute some > shell commands(make etc.) in that folder. I just gave 'ls' for the > sake of an example. The real problem I am facing is, how to stay in > the folder

Re: ConfigParser.items sorting

2009-10-28 Thread Jon Clements
On 28 Oct, 21:55, Dean McClure wrote: > On Oct 28, 4:50 pm, Jon Clements wrote: > > > > > On 28 Oct, 06:21, Dean McClure wrote: > > > > Hi, > > > > Just wondering how I can get theitems() command fromConfigParserto > > > not resort all the item pairs that it presents. > > > > I am trying to get

Working threads progress

2009-10-28 Thread mattia
hi all, I have a simple program that uses multiple threads to carry out some work. Every threads share the same queue.Queue() (that is synchronized) in order to get some data and then carry out the work. Suppose I have something like: q = queue.Queue() for x in range(100): q.put(x) then I ha

Re: ftpilb.FTP.stor...() freeze mystery

2009-10-28 Thread Gabriel Genellina
En Wed, 28 Oct 2009 08:05:22 -0300, Anthra Norell escribió: Gabriel Genellina wrote: En Tue, 27 Oct 2009 07:53:36 -0300, Anthra Norell escribió: I am trying to upload a bunch of web pages to a hosting service.[...] I wrote a loop that iterates through the file names and calls either of

Re: Web development with Python 3.1

2009-10-28 Thread Albert Hopkins
On Wed, 2009-10-28 at 16:38 +0200, Dotan Cohen wrote: > > return HttpResponse(unmaintanable_html % data) > > > > That's fine for single variables, but if I need to output a table of > unknown rows? I assume that return means the end of the script. > Therefore I should shove the whole table into a

Re: Web development with Python 3.1

2009-10-28 Thread Rami Chowdhury
On Wed, 28 Oct 2009 14:15:54 -0700, Dotan Cohen wrote: What do you mean by "in the middle of the page"? Do you mean, for instance, the behavior of "middle.php" in the following PHP example: Is that what you are after? Yes, that is what I am after. For instance, if one were to look at

Re: Web development with Python 3.1

2009-10-28 Thread Albert Hopkins
On Wed, 2009-10-28 at 15:32 +0200, Dotan Cohen wrote: > > def index(request): > >unmaintanable_html = """ > > > > > >Index > > > > > >Embedded HTML is a PITA > >but some like pains... > > > > > > """ > >return HttpResponse(unmaintanable_html) > > > > And if I need to

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Alf P. Steinbach
* Alf P. Steinbach: Hi. Or, to whomever this concerns... ;-) I thought it would be prudent to install 3.1.1 for Windows from scratch, so I uninstalled everything (CPython, ActivePython), and then installed Python 3.1.1. In the "Advanced" option I told the installer to compile packages. Th

Re: Question on PEP 337

2009-10-28 Thread Vinay Sajip
Gabor Urban gmail.com> writes: > > Hy guys, > > this PEP is very well written, and I have found the discussion inspiring. > > Every time I use the logging module, I have the configuration hardcoded in > the application. That is why I never used the configuration file based > approach. Now I wi

Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Alf P. Steinbach
Hi. Or, to whomever this concerns... ;-) I thought it would be prudent to install 3.1.1 for Windows from scratch, so I uninstalled everything (CPython, ActivePython), and then installed Python 3.1.1. In the "Advanced" option I told the installer to compile packages. The compiler then found

Re: PEP 391 (Dictionary-Based Configuration for Logging) Updated

2009-10-28 Thread Vinay Sajip
Wolodja Wentland cl.uni-heidelberg.de> writes: > > All feedback gratefully received! > > The PEP does not seem to specify how handler are retrieved by their > name/id. How should this work? Especially given the statement: > > "The handler name lookup dictionary is for configuration use only

Re: calling server side function

2009-10-28 Thread Chris Colbert
I second the suggestion for XML-RPC... It also solves the security issue in your example, by only exporting functions you specifically register... look at xmlrpclib in the standard python library. On Wed, Oct 28, 2009 at 8:59 AM, Gabriel Genellina wrote: > En Wed, 28 Oct 2009 04:04:50 -0300, Pa

Re: IDLE python shell freezes after running show() of matplotlib

2009-10-28 Thread Chris Colbert
This is a threading issue that is very common when using gui toolkits with the interactive interpreter. You're better off just using ipython, which already has builtin support for matplotlib when you start it via "ipython -pylab" On Wed, Oct 28, 2009 at 7:41 PM, OKB (not okblacke) wrote: > For

Re: ConfigParser.items sorting

2009-10-28 Thread Dean McClure
On Oct 28, 4:50 pm, Jon Clements wrote: > On 28 Oct, 06:21, Dean McClure wrote: > > > > > > > Hi, > > > Just wondering how I can get theitems() command fromConfigParserto > > not resort all the item pairs that it presents. > > > I am trying to get it to read some data in order: > > > [Relay Info]

Re: Web development with Python 3.1

2009-10-28 Thread Dotan Cohen
> What do you mean by "in the middle of the page"? Do you mean, for instance, > the behavior of "middle.php" in the following PHP example: > > > include_once("beginning.inc.php"); > > include_once("middle.php"); > > include_once("end.inc.php"); > > ?> > > Is that what you are after? > Yes, that i

Re: "Hello, world"?

2009-10-28 Thread CM
On Oct 28, 5:40 am, Gilles Ganault wrote: > Hello > > I'm reading O'Reily's "Python Programming on Win32", but couldn't find > a simple example on how to create a window with just a label and > pushbutton. > > If someone has such a basic example handy, I'm interested. > > Thank you. In wxPython (

Re: Web development with Python 3.1

2009-10-28 Thread Rami Chowdhury
On Wed, 28 Oct 2009 12:42:17 -0700, Dotan Cohen wrote: I've already given you that for TG: class RootController(BaseController):   @expose()   def page(self, torwalds=None):       return "%s" % (torwalds if torwalds else "" Does return mean that this could not be used in the middle of

Re: Question on PEP 337 (Vinay Sajip)

2009-10-28 Thread Gabor Urban
Hy guys, Sorry, Vinay Sajip was right. I wrote my questions about PEP 391. I would like to know your ideas about my questions posted in my last mail. Gabor -- Linux: Choice of a GNU Generation -- http://mail.python.org/mailman/listinfo/python-list

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Alf P. Steinbach
* Dann Corbit: In article , al...@start.no Unfortunately Google docs doesn't display the nice table of contents in each document, but here's the public view of ch 1 (complete) and ch 2 (about one third completed, I've not yet settled on a title so it's just chapter "asd"): http://previ

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Dann Corbit
In article , ste...@remove.this.cybersource.com.au says... > > On Wed, 28 Oct 2009 07:52:17 +0100, Alf P. Steinbach wrote: > > > Unfortunately Google docs doesn't display the nice table of contents in > > each document, but here's the public view of ch 1 (complete) and ch 2 > > (about one third

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Dann Corbit
In article , al...@start.no says... > > [Cross-posted comp.programming and comp.lang.python] > > Hi. > > I may finally have found the perfect language for a practically oriented > introductory book on programming, namely Python. > > C++ was way too complex for the novice, JScript and C# suffe

Re: Web development with Python 3.1

2009-10-28 Thread Dotan Cohen
>> Actually, currently in the example url >> http://example.com/path/to/script.py?var1=hello&var2=world the script >> is /home/user/site-name/public_html/path/ (with no filename extension) >> and the script.py is actually page.html which is an arbitrary, >> descriptive string and not part of the sc

Building Python on Solaris 10?

2009-10-28 Thread Judy Booth
Can anyone point me towards some instructions for building Python on Solaris 10? We need this for some of our test scripts and so far we cannot get this to build. We have tried both Python 2.6.4 and 3.1.1 and both fail with messages like this: Include/pyport.h:685:2: #error "LONG_BIT definition

Re: Web development with Python 3.1

2009-10-28 Thread Dotan Cohen
> I've already given you that for TG: > > class RootController(BaseController): > >   @expose() >   def page(self, torwalds=None): >       return "%s" % (torwalds if torwalds > else "" > Does return mean that this could not be used in the middle of a page? > Of course nobody would do it that way

Re: Web development with Python 3.1

2009-10-28 Thread Dotan Cohen
>> It >> did not look like I had any control over the tags at all. > > I can tell you you have full control over the whole HTTP response's content > and headers. And FWIW, this has nothing to do with templating systems. > That's good to know. Actually, it's more that good: I am looking into Django

Re: how to zip a StringIO object?

2009-10-28 Thread Dave Angel
Nagy Viktor wrote: Hi, I try to run the following code: def generate_zip(object_list, template): result = StringIO.StringIO() zipped = zipfile.ZipFile(result, "w") for object in object_list: pdf = generate_pdf(object, template) if not pdf: raise IOError("

Re: IDLE python shell freezes after running show() of matplotlib

2009-10-28 Thread OKB (not okblacke)
Forrest Sheng Bao wrote: > I am having a weird problem on IDLE. After I plot something using show > () of matplotlib, the python shell prompt in IDLE just freezes that I > cannot enter anything and there is no new ">>>" prompt show up. I > tried ctrl - C and it didn't work. I have to restart IDLE

Re: PEP 391 (Dictionary-Based Configuration for Logging) Updated

2009-10-28 Thread Wolodja Wentland
On Wed, Oct 28, 2009 at 10:27 +, Vinay Sajip wrote: > I've updated PEP 391 (Dictionary-Based Configuration for Logging): > http://svn.python.org/view/peps/trunk/pep-0391.txt?r1=75599&r2=75918 +1 > All feedback gratefully received! The PEP does not seem to specify how handler are retrieved by

Re: Reference values for exec

2009-10-28 Thread Garito
Ok, imagine then that I need to execute code from a database query What I'm trying to do is something similar that Python Scripts in Zope. Do you know it? How can I do that? Thanks you !! 2009/10/28 Dave Angel > (You top-posted, so I almost missed your addition. It's conventional on > this n

Re: Reference values for exec

2009-10-28 Thread Dave Angel
(You top-posted, so I almost missed your addition. It's conventional on this newsgroup to bottom-post -- inline where appropriate, or at the end) Garito wrote: Perhaps but the fact is that I need to execute code from some files in the filesystem and I need to have a common stack for them 2 qu

Re: What IDE has good git and python support?

2009-10-28 Thread Simon Forman
On Tue, Oct 27, 2009 at 11:56 AM, Aweks wrote: > what do you use? I use IDLE for python and Bash for GIT. Regards, ~Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: Deeper copy than deepcopy

2009-10-28 Thread Scott Pakin
Thanks everyone! The list-comprehension approach should work in my case as I know a priori that my data structure is finite. Still, it'd be awfully convenient for Python's copy module to offer a copy.deepercopy function -- even if it comes with the caveat that it will explode if given a data stru

PyGDChart2 module

2009-10-28 Thread eb303
Hi all, I was looking for a simple chart drawing Python module and as a user of the gd library and its Python interface, I was interested in the Python interface to the gdchart library (http://www.fred.net/brv/ chart/). Unfortunately, this module seems to have disappeared: its former URL (http://w

how to zip a StringIO object?

2009-10-28 Thread Nagy Viktor
Hi, I try to run the following code: def generate_zip(object_list, template): result = StringIO.StringIO() zipped = zipfile.ZipFile(result, "w") for object in object_list: pdf = generate_pdf(object, template) if not pdf: raise IOError("Problem with generati

Re: Web development with Python 3.1

2009-10-28 Thread John Nagle
Diez B. Roggisch wrote: John Nagle schrieb: Alan Harris-Reid wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 Until MySQLdb gets ported to something later than Python 2.5, support for a "data-based web site" pr

Re: how to get os.system () call to cooperate on Windows

2009-10-28 Thread David Robinow
On Wed, Oct 28, 2009 at 12:43 AM, Gabriel Genellina wrote: > How can one copy files on the OS level? > The idea was just to show how to call CopyFile using ctypes, not implying > that it's the only way to do that. Everyone knows that the One and True Way > of copying files is using PIP. Yuk!

Re: popen function of os and subprocess modules

2009-10-28 Thread banu
On Oct 28, 3:18 pm, Benjamin Kaplan wrote: > On Wed, Oct 28, 2009 at 9:39 AM, banu wrote: > > Hi, > > I am a novice in python. I was trying to write a simple script on > > Linux (python 3.0) that does the following > > > #cd directory > > #ls -l > > > I use the following code, but it doesn't work

Re: Web development with Python 3.1

2009-10-28 Thread Bruno Desthuilliers
Dotan Cohen a écrit : *Why* on earth do you think using a templating system will give you any less control on the generated HTML ? Because I am wrong. I have already come to that conclusion. I know that Python is far enough developed that if I feel that I am fighting it, then _I_ am in the wr

Re: Web development with Python 3.1

2009-10-28 Thread Dotan Cohen
> *Why* on earth do you think using a templating system will give you any less > control on the generated HTML ? > Because I am wrong. I have already come to that conclusion. I know that Python is far enough developed that if I feel that I am fighting it, then _I_ am in the wrong, not Python. How

Re: Web development with Python 3.1

2009-10-28 Thread Bruno Desthuilliers
Dotan Cohen a écrit : >>> I insist on handling the HTML myself. >> I just don't get how embedding HTML in applicative code - a well-known >> antipattern FWIW - relates to "handling the HTML yourself". Can you *please* >> explain how a templating system prevents you from "handling the HTML" >> yo

Re: Reference values for exec

2009-10-28 Thread Garito
Perhaps but the fact is that I need to execute code from some files in the filesystem and I need to have a common stack for them 2 questions came to my mind: 1.- How can I execute code from files in the filesystem? (I choose exec for that) 2.- If exec is my only option: how can I use a common sta

Re: Reference values for exec

2009-10-28 Thread Dave Angel
Garito wrote: Hi! I'm trying to use exec in a recursive way but I have a problem When I read the manual I understand that the globals and the locals are passed by reference but if I try to use it in a recursive way the new values added in a step are not passed to the next one Could someone poin

Re: Web development with Python 3.1

2009-10-28 Thread Bruno Desthuilliers
Dotan Cohen a écrit : While I know that to be true in the general sense, from what I've looked at Django and other frameworks it seems that the web frameworks push the coder to use templates, not letting him near the HTML. Well... there must be a reason, for sure... No ? ֹYes, but I don't like

Re: popen function of os and subprocess modules

2009-10-28 Thread banu
On Oct 28, 3:02 pm, Jon Clements wrote: > On 28 Oct, 13:39, banu wrote: > > > > > Hi, > > I am a novice in python. I was trying to write a simple script on > > Linux (python 3.0) that does the following > > > #cd directory > > #ls -l > > > I use the following code, but it doesn't work: > > > impo

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Alf P. Steinbach
* Jon Clements: Inline reply: On 28 Oct, 11:49, "Alf P. Steinbach" wrote: * Jon Clements: On 28 Oct, 08:58, "Alf P. Steinbach" wrote: [snip] Without reference to an OS you can't address any of the issues that a beginner has to grapple with, including most importantly tool usage, without wh

Re: popen function of os and subprocess modules

2009-10-28 Thread Benjamin Kaplan
On Wed, Oct 28, 2009 at 9:39 AM, banu wrote: > Hi, > I am a novice in python. I was trying to write a simple script on > Linux (python 3.0) that does the following > > #cd directory > #ls -l > > I use the following code, but it doesn't work: > > import os > directory = '/etc' > pr = os.popen('cd %

Re: Web development with Python 3.1

2009-10-28 Thread Bruno Desthuilliers
Dotan Cohen a écrit : I have no idea what reverse url generation is. It's a mean to avoid hard-coding urls in your application code - the url is fully generated by the 'url mapping' system. I don't need that, see below. I assume that the user will call http://example.com/path/to/script.py?

Re: Question on PEP 337

2009-10-28 Thread Vinay Sajip
Gabor Urban gmail.com> writes: > this PEP is very well written, and I have found the discussion inspiring. > > Every time I use the logging module, I have the configuration hardcoded in > the application. That is why I never used the configuration file based > approach. Now I will give it a try.

Re: popen function of os and subprocess modules

2009-10-28 Thread Jon Clements
On 28 Oct, 13:39, banu wrote: > Hi, > I am a novice in python. I was trying to write a simple script on > Linux (python 3.0) that does the following > > #cd directory > #ls -l > > I use the following code, but it doesn't work: > > import os > directory = '/etc' > pr = os.popen('cd %s' % directory,

Re: logging from several independent classes

2009-10-28 Thread Vinay Sajip
Sandy gmail.com> writes: > > Hi all, > I was going through the last example in logging docs: > http://docs.python.org/library/logging.html#using-logging-in-multiple-modules > > It explains how to log from multiple classes. The example works fine The documentation you pointed to is about loggin

Re: Python + twisted = Raindrop (in part)

2009-10-28 Thread J Kenneth King
Terry Reedy writes: > Rrom: > First look: inside Mozilla's Raindrop messaging platform > > http://arstechnica.com/open-source/news/2009/10/first-look-inside-mozillas-raindrop-messaging-platform.ars > > "The backend components that are responsible for retrieving and > processing messages are coded

Re: Web development with Python 3.1

2009-10-28 Thread Diez B. Roggisch
Dotan Cohen wrote: >>> I insist on handling the HTML myself. >> >> I just don't get how embedding HTML in applicative code - a well-known >> antipattern FWIW - relates to "handling the HTML yourself". Can you >> *please* explain how a templating system prevents you from "handling the >> HTML" your

  1   2   >