Re: python 2.6: Need some advise for installing modules on a legacy system

2021-02-26 Thread Thomas Jollans
On 24/02/2021 14:13, Antoon Pardon wrote: > I need to do some development on this legacy system. It only runs > python2.6 and there is little hope of installing an other version. How > can I best proceed to install modules for working with mysql and ldap? > The answer very much depends on the oper

Re: python 2.6: Need some advise for installing modules on a legacy system

2021-02-24 Thread Dan Stromberg
You also could try getting the modules (of suitable versions) you need from their homepage, possibly github, and then use the setup.py to install your packages. pypi usually has a link to a project's homepage. On Wed, Feb 24, 2021 at 6:08 AM Dan Stromberg wrote: > > I don't think pip supports 2

Re: python 2.6: Need some advise for installing modules on a legacy system

2021-02-24 Thread Dan Stromberg
I don't think pip supports 2.x anymore. You might be able to: 1) Look up what versions of your desired modules support Python 2.x on pypi's website 2) Install them on another system that has Python 3.x using pip 3) Copy them to the moribund system 4) Test On Wed, Feb 24, 2021 at 5:15 AM Antoon P

Re: Python 2.6 and Sqlite3 - Slow

2012-08-28 Thread Pedro Larroy
Try incrementing the variable cursor.arraysize a lot. Pedro. On Tue, Aug 28, 2012 at 11:20 PM, Dennis Lee Bieber wrote: > On Tue, 28 Aug 2012 10:25:35 -0700 (PDT), bruceg113...@gmail.com > declaimed the following in gmane.comp.python.general: > >> >> Doesn't the last paragraph imply that SQLite

Re: Python 2.6 and Sqlite3 - Slow

2012-08-28 Thread bruceg113355
On Tuesday, August 28, 2012 4:27:48 AM UTC-4, Cameron Simpson wrote: > On 27Aug2012 13:41, bruceg113...@gmail.com wrote: > > | When using the database on my C Drive, Sqlite performance is great! (<1S) > > | When using the database on a network, Sqlite performance is terrible! (17S) > > > >

Re: Python 2.6 and Sqlite3 - Slow

2012-08-28 Thread Cameron Simpson
On 27Aug2012 13:41, bruceg113...@gmail.com wrote: | When using the database on my C Drive, Sqlite performance is great! (<1S) | When using the database on a network, Sqlite performance is terrible! (17S) Let me first echo everyone saying not to use SQLite on a network file. | I like your idea

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread Bryan
bruceg113 wrote: > Thank you for your reply. > Are you saying having a sqlite database file on a > shared LOCAL network drive is problematic? Yes, mostly, I think I am saying that. A "LOCAL network drive" is network drive, and is not a local drive, local as the network may be. We read and write s

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread ian douglas
>From the sqlite documentation he quoted, it appears that ANY network filesystem, local or otherwise, should be avoided. On Aug 27, 2012 8:13 PM, wrote: > On Monday, August 27, 2012 10:32:47 PM UTC-4, Bryan wrote: > > bruceg113 wrote: > > > > > I selected sqlite for the following reasons: > > > >

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread bruceg113355
On Monday, August 27, 2012 10:32:47 PM UTC-4, Bryan wrote: > bruceg113 wrote: > > > I selected sqlite for the following reasons: > > > > > > 1) Ships with Python. > > > 2) Familiar with Python. > > > 3) The Sqlite description athttp://www.sqlite.org/whentouse.htmlappears to > > meet my requir

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread Bryan
bruceg113 wrote: > I selected sqlite for the following reasons: > > 1) Ships with Python. > 2) Familiar with Python. > 3) The Sqlite description athttp://www.sqlite.org/whentouse.htmlappears to > meet my requirements: >     Very low volume and concurrency, small datasets, simple to use. All good

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread bruceg113355
Demian, I am not a database expert! I selected sqlite for the following reasons: 1) Ships with Python. 2) Familiar with Python. 3) The Sqlite description at http://www.sqlite.org/whentouse.html appears to meet my requirements: Very low volume and concurrency, small datasets, simple to use.

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread Demian Brecht
Is there a reason that you're using SQLite in a network environment rather than a database server? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread bruceg113355
Uli, Answers to your questions: 1) There are approx 65 records and each record is 68 bytes in length. 2) Not applicable because number of records is fixed. 3) Takes less than a second to read all 65 records when all is well. Takes 17 seconds to read all 65 records when all is NOT WELL 4) Perfor

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread ahsanraza211
On Monday, August 27, 2012 8:50:15 AM UTC-7, Ulrich Eckhardt wrote: > Am 27.08.2012 03:23, schrieb bruceg113...@gmail.com: > > > My program uses Python 2.6 and Sqlite3 and connects to a network > > > database 100 miles away. > > > > Wait, isn't SQLite completely file-based? In that case, SQLit

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread Ulrich Eckhardt
Am 27.08.2012 03:23, schrieb bruceg113...@gmail.com: My program uses Python 2.6 and Sqlite3 and connects to a network database 100 miles away. Wait, isn't SQLite completely file-based? In that case, SQLite accesses a file, which in turn is stored on a remote filesystem. This means that there a

Re: Python 2.6 StreamReader.readline()

2012-07-25 Thread wxjmfauth
On Wednesday, July 25, 2012 11:02:01 AM UTC+2, Walter Dörwald wrote: > On 25.07.12 08:09, Ulrich Eckhardt wrote: > > > Am 24.07.2012 17:01, schrieb cpppw...@gmail.com: > >> reader = codecs.getreader(encoding) > >> lines = [] > >> with open(filename, 'rb') as f: > >> lines

Re: Python 2.6 StreamReader.readline()

2012-07-25 Thread Walter Dörwald
On 25.07.12 08:09, Ulrich Eckhardt wrote: Am 24.07.2012 17:01, schrieb cpppw...@gmail.com: reader = codecs.getreader(encoding) lines = [] with open(filename, 'rb') as f: lines = reader(f, 'strict').readlines(keepends=False) where encoding == 'utf-16-be' Everything wo

Re: Python 2.6 StreamReader.readline()

2012-07-24 Thread Ulrich Eckhardt
Am 24.07.2012 17:01, schrieb cpppw...@gmail.com: reader = codecs.getreader(encoding) lines = [] with open(filename, 'rb') as f: lines = reader(f, 'strict').readlines(keepends=False) where encoding == 'utf-16-be' Everything works fine, except that lines[0] is equal to c

Re: Python 2.6 on Mac 10.7 doesn't work

2012-07-17 Thread Ned Deily
In article <5005927a$0$6949$e4fe5...@news2.news.xs4all.nl>, Hans Mulder wrote: > On 17/07/12 15:47:05, Naser Nikandish wrote: > > I am trying to install Python 2.6 on Mac OS Lion. Here is what I did: > > > > 1- Download Mac Installer disk image (2.6) (sig) from > >http://www.python.org/get

Re: Python 2.6 on Mac 10.7 doesn't work

2012-07-17 Thread Hans Mulder
On 17/07/12 15:47:05, Naser Nikandish wrote: > Hi, > > I am trying to install Python 2.6 on Mac OS Lion. Here is what I did: > > 1- Download Mac Installer disk image (2.6) (sig) from >http://www.python.org/getit/releases/2.6/ > > 2- Install it > > 3- Run Python Luncher, go to Python Lunch

Re: Python 2.6 OR 3.2

2011-06-13 Thread geremy condra
On Thu, Jun 9, 2011 at 11:00 PM, harrismh777 wrote: > Andrew Berg wrote: >> >> AFAICT, there are three reasons to learn Python 2: > >   ... there is a fourth reason. > > The linux distro you are using currently was customized with python 2.x > > I ran into this problem this week in fact... on my H

Re: Python 2.6 OR 3.2

2011-06-13 Thread Chris Angelico
On Tue, Jun 14, 2011 at 9:08 AM, SigmundV wrote: > To the OP I'd say: learn Python through 3.2. It's the best way > forward, for the sake of yourself and others. The only way more > modules can become 3k compatible is if more people use 3k. I skipped 3.2 and went straight to 3.3a0 from hg, but th

Re: Python 2.6 OR 3.2

2011-06-13 Thread SigmundV
I'm using 2.7.1, because that's what my Ubuntu 11.04 bundles (python -- version reports 2.7.1+ though, no idea what the + means). On the other hand, Ubuntu provides 3.2 packages via apt-get, so I'm in the process of migrating to 3k. I really like the focus on laziness in 3k (don't know if 'focus' i

Re: Python 2.6 OR 3.2

2011-06-10 Thread Steven D'Aprano
On Fri, 10 Jun 2011 01:00:35 -0500, harrismh777 wrote: > So, be careful. I have had to separate *all* of my python installs on > *every* one of my systems for this similar reason. The bottom line is if > the distro ships with 2.6 (minus the idle) chances are that the > interpreter is there *not*

Re: Python 2.6 OR 3.2

2011-06-10 Thread Benjamin Kaplan
On Thu, Jun 9, 2011 at 11:00 PM, harrismh777 wrote: > Andrew Berg wrote: >> >> AFAICT, there are three reasons to learn Python 2: > >   ... there is a fourth reason. > > The linux distro you are using currently was customized with python 2.x > > I ran into this problem this week in fact... on my H

Re: Python 2.6 OR 3.2

2011-06-09 Thread harrismh777
Andrew Berg wrote: AFAICT, there are three reasons to learn Python 2: ... there is a fourth reason. The linux distro you are using currently was customized with python 2.x I ran into this problem this week in fact... on my HP g6 ubuntu notebook running 10.04 lucid. It ships with the 2.6.5

Re: Python 2.6 OR 3.2

2011-06-09 Thread harrismh777
Terry Reedy wrote: A couple of years ago, users were people who were already programming with 2.x. That is changing now. ... big time ! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6 OR 3.2

2011-06-09 Thread Andrew Berg
On 2011.06.09 12:18 PM, hisan wrote: > Hi All, > > Please let me know which one is GOOD whether Python 2.6 OR 3.2. > Please let me know the difference between them. > Please give some refernce site or books to know the difference I'm just a beginner, but AFAICT, there are three reasons to learn Pyt

Re: Python 2.6 OR 3.2

2011-06-09 Thread Terry Reedy
On 6/9/2011 11:41 PM, Kyle T. Jones wrote: Library support. I urge people who use 2.x only for library support to let library authors that they would have preferred a 3.x compatible library. I have library authors say "Why port when none of my users have asked for a port?" A couple of year

Re: Python 2.6 OR 3.2

2011-06-09 Thread Kyle T. Jones
John Gordon wrote: In <9037ef5f-53c5-42c6-ac5d-8f942df6c...@x38g2000pri.googlegroups.com> hisan writes: Hi All, Please let me know which one is GOOD whether Python 2.6 OR 3.2. Please let me know the difference between them. Please give some refernce site or books to know the difference I

Re: Python 2.6 OR 3.2

2011-06-09 Thread Dan Stromberg
If your dependencies are satisfiable with 3.2, you're better off with 3.2. If not, use 2.7, or consider porting the dependencies yourself (assuming those dependencies have code available). Both 2.x and 3.x are good, but 3.x is clearly the way forward. 3.x has some annoyances corrected: more cent

Re: Python 2.6 OR 3.2

2011-06-09 Thread Chris Angelico
On Fri, Jun 10, 2011 at 3:18 AM, hisan wrote: > Hi All, > > Please let me know which one is GOOD whether Python 2.6 OR 3.2. As a side point, you should probably use 2.7 rather than 2.6. With regard to 2.x versus 3.x, Corey already posted a link to an excellent article. Chris Angelico -- http://

Re: Python 2.6 OR 3.2

2011-06-09 Thread Corey Richardson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/09/2011 01:18 PM, hisan wrote: > Hi All, > > Please let me know which one is GOOD whether Python 2.6 OR 3.2. > Please let me know the difference between them. > Please give some refernce site or books to know the difference http://wiki.python.o

Re: Python 2.6 OR 3.2

2011-06-09 Thread John Gordon
In <9037ef5f-53c5-42c6-ac5d-8f942df6c...@x38g2000pri.googlegroups.com> hisan writes: > Hi All, > Please let me know which one is GOOD whether Python 2.6 OR 3.2. > Please let me know the difference between them. > Please give some refernce site or books to know the difference If you're starting

Re: Python 2.6 and timezones

2011-05-23 Thread Miki Tebeka
> [1] http://pypi.python.org/pypi/PosixTimeZone/0.9.4 > [2] http://pypi.python.org/pypi/pytz/2011g > [3] http://docs.python.org/library/datetime.html#tzinfo-objects Also http://labix.org/python-dateutil#head-587bd3efc48f897f55c179abc520a34330ee0a62 HTH -- Miki Tebeka http://pythonwise.blogspot.c

Re: Python 2.6 and timezones

2011-05-23 Thread Daniel Kluev
On Mon, May 23, 2011 at 10:56 PM, loial wrote: > Thanks...but being a python newbie I am struggling to understand how > to do this. > > How can I use tzinfo to do the equivalent of what I do in Java, which > is : > >TimeZone tz1 = TimeZone.getDefault(); > >long localOffset = tz1.getOffset

Re: Python 2.6 and timezones

2011-05-23 Thread loial
Thanks...but being a python newbie I am struggling to understand how to do this. How can I use tzinfo to do the equivalent of what I do in Java, which is : TimeZone tz1 = TimeZone.getDefault(); long localOffset = tz1.getOffset(date.getTime()); TimeZone tz2 = TimeZone.getTimeZone("E

Re: Python 2.6 and timezones

2011-05-23 Thread Daniel Kluev
On Mon, May 23, 2011 at 9:32 PM, loial wrote: > Does python have an equivalent of the java Timezone object? > > I need to be able to get offsets for timezones (only U.S. time zones > at the moment) Depends on what exactly do you want. If you need to convert timezone name into current offset, you

Re: Python 2.6: How to turn off cgitb.py's DeprecationWarning: BaseException.message has been deprecated

2010-09-24 Thread Thomas Jollans
On Friday 24 September 2010, it occurred to pyt...@bdurham.com to exclaim: > Python 2.6: We're using the standard lib's cgitb module to > provide diagnostic messages when unexpected exceptions occur. > > Unfortunately, this module raises a DeprecationWarning like below > when it is used: > > C:\P

Re: Python 2.6 & bsddb

2010-09-21 Thread Sridhar Ratnakumar
On 2010-09-21, at 9:04 AM, garyr wrote: > I recently installed ActivePython 2.6.6 and my programs that use anydbm or > shelve generate import errors because bsddb is missing. I installed bsddb3 > (bsddb3-5.0.0.win32-py2.6.exe) but that didn't change anything. What more do > I need to do? You

Re: Python 2.6.x version module compatibility

2010-06-28 Thread Stephen Hansen
On 6/28/10 9:06 AM, Ratufa wrote: Suppose I have a webapp running in a virtualenv (--no-site-packages) cloned off a Python 2.6.2 install, running under mod_wsgi. The virtual environment has various modules installed in it, some perhaps using C extensions. Question: If the Python installation

Re: python 2.6 py2exe wx app fails

2010-04-23 Thread Robin Becker
On 22/04/2010 13:56, Robin Becker wrote: I'm trying to move a wxPython application forward to 2.6, but although the app runs fine in 2.6 when run directly when I build the app into an exe using py2exe I get this popup message "application failed to initialize properly (0xc142)" when I try

Re: Python 2.6 SSL module: Fails on key file error, with Errno 336265225, without a key file.

2010-04-19 Thread John Nagle
Antoine Pitrou wrote: Perhaps you are using the wrong parameters and looking for ca_certs instead: That's right. Thanks. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6 SSL module: Fails on key file error, with Errno 336265225, without a key file.

2010-04-19 Thread Antoine Pitrou
Le Sun, 18 Apr 2010 22:37:30 -0700, John Nagle a écrit : > > The cert file is the same PEM file I use with M2Crypto, and it's derived > from Firefox's cert file. > > Why am I getting a "private key" related error? I'm not submitting a > keyfile, just a cert file. I'm not an expert but this is w

Re: Python 2.6 and modules dbi AND odbc

2010-03-11 Thread Kev Dwyer
On Wed, 10 Mar 2010 16:17:29 -0800, robert somerville wrote: > hi; > i am trying to get some legacy python code (which i no nothing about) > working with tries to import dbi and odbc (the import fails ...) it > looks like these modules are deprecated ?? if so is there a work around > , if not dep

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-04 Thread Tim Roberts
News123 wrote: > >Yes, this might be an option >Somehow though it didn't feel right for me to depend on internal non >documented data types, which might change between releases of PIL. That's absolutely true. If performance is a priority, somethimes you have to do things that are "dirty". Just

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-03 Thread Stefan Behnel
News123, 03.03.2010 10:37: Stefan Behnel wrote: Take a look at Cython instead, it will allow you to access PIL's image buffer directly, instead of copying the data. It will also simplify and speed up your C wrapper code. I don't know Cython. Having looked at the web site I'm not entirely sure,

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-03 Thread News123
Hi Stefan, Stefan Behnel wrote: > News123, 03.03.2010 01:38: >> I created a grayscale image with PIL. >> >> Now I would like to write a C function, which reads a;most all pixels >> and will modify a few of them. >> >> My current approach is: >> - transform the image to a string() >> - create a byt

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-03 Thread Stefan Behnel
News123, 03.03.2010 01:38: I created a grayscale image with PIL. Now I would like to write a C function, which reads a;most all pixels and will modify a few of them. My current approach is: - transform the image to a string() - create a byte array huge enough to contain the resulting image - ca

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-03 Thread News123
Hi Tim, Tim Roberts wrote: > News123 wrote: >> I created a grayscale image with PIL. >> >> Now I would like to write a C function, which reads a;most all pixels >> and will modify a few of them. >> >> My current approach is: >> - transform the image to a string() >> - create a byte array huge eno

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-02 Thread Tim Roberts
News123 wrote: > >I created a grayscale image with PIL. > >Now I would like to write a C function, which reads a;most all pixels >and will modify a few of them. > >My current approach is: >- transform the image to a string() >- create a byte array huge enough to contain the resulting image >- call

Re: Python 2.6 ftplib has timeout parameter, but how to detect a timeout

2009-12-30 Thread Giampaolo Rodola'
On 30 Dic, 18:52, MrJean1 wrote: > Brendan, > > The timeout argument of the FTP class (and the connect method) is used > only to establish the connection to FTP sockets.  If the timeout > expires, an error called socket.timeout is raised. > > AFAIK, the timeout argument does not limit FTP transfer

Re: Python 2.6 ftplib has timeout parameter, but how to detect a timeout

2009-12-30 Thread MrJean1
Brendan, The timeout argument of the FTP class (and the connect method) is used only to establish the connection to FTP sockets. If the timeout expires, an error called socket.timeout is raised. AFAIK, the timeout argument does not limit FTP transfers. To impose a time limit on FTP transfers, t

Re: Python 2.6 ftplib has timeout parameter, but how to detect a timeout

2009-12-30 Thread Giampaolo Rodola'
On 14 Dic, 20:08, Brendan wrote: > I was quite happy to see that ftplib in Python 2.6 now has a timeout > parameter. With large file downloads my script would often hang, > presumably from timing out. Now that there is a timeout parameter, how > would I detect when a timeout occurs? The socket ob

Re: Python 2.6 ftplib has timeout parameter, but how to detect a timeout

2009-12-29 Thread Aahz
In article , Brendan wrote: > >I was quite happy to see that ftplib in Python 2.6 now has a timeout >parameter. With large file downloads my script would often hang, >presumably from timing out. Now that there is a timeout parameter, how >would I detect when a timeout occurs? Without looking at

Re: Python 2.6 Global Variables

2009-10-30 Thread Aahz
In article <888b5e8f-1be5-4040-bc7a-45c2e1695...@d9g2000prh.googlegroups.com>, AK Eric wrote: >> >> 2/ in Python, "global" really means "module-level" - there's nothing >> like a "true" global namespace. > >Isn't that __main__? > >import __main__ >__main__.foo = "asdfasdf" > >print foo ># asdfasd

Re: Python 2.6 Global Variables

2009-10-30 Thread Stephen Hansen
On Fri, Oct 30, 2009 at 9:01 AM, AK Eric wrote: > Should we start talking about how you can add stuff to __builtin__ and > then it really is exposed to everything? (right, unless I'm missing > some other Python idiom?) Again, *not advocating* in standard > practice, but I think it's important to

Re: Python 2.6 Global Variables

2009-10-30 Thread AK Eric
> > It isn't a neat trick anymore once you realize the name '__main__' > > isn't special. > > > Replace __main__ with foo, or config, or whatever, and you get the > > same results. Ok, there is a catch: a file with that name must exist, > > at least an empty one... True. I do feel a bit less spec

Re: Python 2.6 Global Variables

2009-10-30 Thread Dave Angel
Gabriel Genellina wrote: En Fri, 30 Oct 2009 00:29:27 -0300, Steven D'Aprano escribió: On Thu, 29 Oct 2009 10:31:03 -0700, AK Eric wrote: 2/ in Python, "global" really means "module-level" - there's nothing like a "true" global namespace. It isn't a neat trick anymore once you realize the

Re: Python 2.6 Global Variables

2009-10-30 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : AK Eric a écrit : 2/ in Python, "global" really means "module-level" - there's nothing like a "true" global namespace. Isn't that __main__? Nope import __main__ __main__.foo = "asdfasdf" print foo # asdfasdf Not advocating, but it does serve the purpose.

Re: Python 2.6 Global Variables

2009-10-30 Thread Bruno Desthuilliers
AK Eric a écrit : 2/ in Python, "global" really means "module-level" - there's nothing like a "true" global namespace. Isn't that __main__? Nope import __main__ __main__.foo = "asdfasdf" print foo # asdfasdf Not advocating, but it does serve the purpose. This won't make 'foo' available

Re: Python 2.6 Global Variables

2009-10-29 Thread Gabriel Genellina
En Fri, 30 Oct 2009 00:29:27 -0300, Steven D'Aprano escribió: On Thu, 29 Oct 2009 10:31:03 -0700, AK Eric wrote: 2/ in Python, "global" really means "module-level" - there's nothing like a "true" global namespace. Isn't that __main__? Well there you go, I just learned something new. I w

Re: Python 2.6 Global Variables

2009-10-29 Thread Steven D'Aprano
On Thu, 29 Oct 2009 10:31:03 -0700, AK Eric wrote: >> 2/ in Python, "global" really means "module-level" - there's nothing >> like a "true" global namespace. > > Isn't that __main__? Well there you go, I just learned something new. I was going to say "No, every module has its own __main__", and

Re: Python 2.6 Global Variables

2009-10-29 Thread Benjamin Kaplan
On Thu, Oct 29, 2009 at 7:11 PM, AK Eric wrote: >> Good that you're not advocating it, because IMHO it's bad practice to >> have circular import dependencies.  By using the __main__ alias, you >> avoid the worst problems, but that just means the others are more subtle. > > I figured I'd get that k

Re: Python 2.6 Global Variables

2009-10-29 Thread AK Eric
> Good that you're not advocating it, because IMHO it's bad practice to > have circular import dependencies.  By using the __main__ alias, you > avoid the worst problems, but that just means the others are more subtle. I figured I'd get that kind of response, not that it's incorrect ;) Great power

Re: Python 2.6 Global Variables

2009-10-29 Thread Dave Angel
AK Eric wrote: 2/ in Python, "global" really means "module-level" - there's nothing like a "true" global namespace. Isn't that __main__? import __main__ __main__.foo = "asdfasdf" print foo # asdfasdf Not advocating, but it does serve the purpose. Good that you're not advocating it,

Re: Python 2.6 Global Variables

2009-10-29 Thread AK Eric
> 2/ in Python, "global" really means "module-level" - there's nothing > like a "true" global namespace. Isn't that __main__? import __main__ __main__.foo = "asdfasdf" print foo # asdfasdf Not advocating, but it does serve the purpose. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6 Global Variables

2009-10-29 Thread Chris Rebert
On Thu, Oct 29, 2009 at 3:25 AM, VYAS ASHISH M-NTB837 wrote: > > Dear all > > How do I write a code that gets executed 'every x' minutes? > > > > I know how to do it 'after x' minutes, I do the following: > > def doAtTimerFire(): >        """ The things I want to do 'after x' minutes go here. """

RE: Python 2.6 Global Variables

2009-10-29 Thread VYAS ASHISH M-NTB837
Dear all How do I write a code that gets executed 'every x' minutes? I know how to do it 'after x' minutes, I do the following: def doAtTimerFire(): """ The things I want to do 'after x' minutes go here. """ And then from main code, I do this: tmr = threading.Timer(timeInSeconds,

Re: Python 2.6 Global Variables

2009-10-29 Thread Bruno Desthuilliers
Ronn Ross a écrit : (please don't top-post - fixed) 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 configuratio

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: 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: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-26 Thread Simon Forman
On Mon, Oct 26, 2009 at 12:04 AM, rh0dium wrote: [snip] > > > Now the real question I have on this is scalability.  The real What you're describing isn't "scalability". It could be called "extensibility". > advantage to using *args and **kwargs is that down the road (through > inheritance/polym

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone expla in why?

2009-10-26 Thread Terry Reedy
Carl Banks wrote: So what is the point of using __new__? .__new__ creates new objects. It also inializes 'immutable' objects. It's mostly for types written in C, or for subclassing types written in C. Specifically, for subclassing immutable classes where one wants initialization behavior

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-25 Thread Carl Banks
On Oct 25, 9:04 pm, rh0dium wrote: > On Oct 22, 9:05 pm, Carl Banks wrote: > > This should suffice for you: > > > class Borg(object): > >     __shared_state = {} > >     def __init__(self, noSend=False,reportLevel=30, > >                  reportMethods="BaseReport", > >                  contacts=

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-25 Thread rh0dium
Carl, First off - Thanks your post was exactly the kind of informative example driven learnings that help — Thanks!! On Oct 22, 9:05 pm, Carl Banks wrote: > > Before we get into object semantics, I'm not sure why you'd need to > override __new__ for Borg pattern, unless they're working around

Re: Python 2.6 Deprecation Warnings with __new__ Can someone explain why?

2009-10-24 Thread Dieter Maurer
Terry Reedy writes on Fri, 23 Oct 2009 03:04:41 -0400: > Consider this: > > def blackhole(*args, **kwds): pass > > The fact that it accept args that it ignores could be considered > misleading or even a bug. Maybe, it could. But, it is by no means necessary. In mathematics, there is a set of i

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone expla in why?

2009-10-23 Thread Terry Reedy
Consider this: def blackhole(*args, **kwds): pass The fact that it accept args that it ignores could be considered misleading or even a bug. Now modify it to do something useful, like return a new, naked, immutable object that is the same for every call except for identity, and which still t

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-22 Thread Stephen Hansen
On Thu, Oct 22, 2009 at 9:09 PM, Stephen Hansen wrote: > >>> class myclass(object): > ... def __new__(cls, *args, **kwargs): > ... print args > ... print kwargs > ... self = object.__new__(cls) > ... return self > ... def __init__(self, *args

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-22 Thread Carl Banks
On Oct 22, 8:12 pm, rh0dium wrote: > Hi all, > > I have a basic Monostate with Python 2.6. > > class Borg(object): >     __shared_state = {} >     def __new__(cls, *args, **kwargs): >         self = object.__new__(cls, *args, **kwargs) >         self.__dict__ = cls.__shared_state >         return

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-22 Thread Stephen Hansen
On Thu, Oct 22, 2009 at 8:12 PM, rh0dium wrote: > In my case the args that it dumps them into a black hold is simply not > true. I want an unknown set of args and kwargs to simply be forwarded > onto init. So what's the problem with this?? > There is no problem with doing that-- the deprecatio

Re: Python 2.6 still not giving memory back to the OS...

2009-08-24 Thread John Machin
On Aug 25, 2:08 am, Chris Withers wrote: > Martin v. Löwis wrote: > > Today, there are two cases when malloc returns memory on a typical > > Unix system (in particular, in Linux malloc): > > a) if the malloc block block is small (below page size), it is allocated > >    from the brk heap, where it

Re: Python 2.6 still not giving memory back to the OS...

2009-08-24 Thread Chris Withers
Martin v. Löwis wrote: Today, there are two cases when malloc returns memory on a typical Unix system (in particular, in Linux malloc): a) if the malloc block block is small (below page size), it is allocated from the brk heap, where it can only be returned if the last page of that heap is

Re: Python 2.6 still not giving memory back to the OS...

2009-08-16 Thread ryles
On Aug 15, 7:55 am, Chris Withers wrote: > Hi All, > > I thought this was fixed back in Python 2.5, but I guess not? > > So, I'm playing in an interactive session: > >  >>> from xlrd import open_workbook >  >>> b = open_workbook('some.xls',pickleable=0,formatting_info=1) > > At this point, top sho

Re: Python 2.6 still not giving memory back to the OS...

2009-08-16 Thread Martin v. Löwis
> As far as releasing memory back to the OS is concerned, I have dim > memories of *x systems where free() would return space to the OS if > the block was "large" and it was next to the "break" point ... this > effect could be what you are seeing. Today, there are two cases when malloc returns mem

Re: Python 2.6 still not giving memory back to the OS...

2009-08-15 Thread John Machin
On Aug 16, 2:41 am, Mark Dickinson wrote: > and got the expected memory usage for my Python process, as > displayed by top:  memory usage went up to nearly 1Gb after > each assignment to b, then dropped down to 19 Mb or so after > each 'del b'.  I get similar results under Python 2.5. > > So maybe

Re: Python 2.6 still not giving memory back to the OS...

2009-08-15 Thread Christian Heimes
Mark Dickinson wrote: and got the expected memory usage for my Python process, as displayed by top: memory usage went up to nearly 1Gb after each assignment to b, then dropped down to 19 Mb or so after each 'del b'. I get similar results under Python 2.5. I get the same results on Linux: Pyt

Re: Python 2.6 still not giving memory back to the OS...

2009-08-15 Thread Mark Dickinson
On Aug 15, 12:55 pm, Chris Withers wrote: > Hi All, > > I thought this was fixed back in Python 2.5, but I guess not? > > So, I'm playing in an interactive session: > >  >>> from xlrd import open_workbook >  >>> b = open_workbook('some.xls',pickleable=0,formatting_info=1) > > At this point, top sh

Re: Python 2.6 still not giving memory back to the OS...

2009-08-15 Thread Dave Angel
Chris Withers wrote: Hi All, I thought this was fixed back in Python 2.5, but I guess not? So, I'm playing in an interactive session: >>> from xlrd import open_workbook >>> b = open_workbook('some.xls',pickleable=0,formatting_info=1) At this point, top shows the process usage for python to be

Re: Python 2.6 in shared/VPS environment

2009-07-31 Thread northof40
Ignore this question. Managed to get Amazon Web Services going and have installed Python 2.6 on there. Thanks for your eyeballs time. On Jul 31, 7:09 pm, northof40 wrote: > Hi - I'd really like to have access to Python 2.6 to try something > out. It needs to be on Linux/Unix machine. I don't mind

Re: python 2.6 packages in python 3.0

2009-06-02 Thread Terry Reedy
Chris Rebert wrote: On Tue, Jun 2, 2009 at 12:51 AM, ssd wrote: Hi, I usually works with packages like pyserial, numpy, mathplotlib,pyUSB, etc.. When is planned that these packages are supported in Python 3.0? That would depend on the individual packages and their maintainers. Check their r

Re: python 2.6 packages in python 3.0

2009-06-02 Thread Chris Rebert
On Tue, Jun 2, 2009 at 12:51 AM, ssd wrote: > Hi, > > I usually works with packages like pyserial, numpy, mathplotlib,pyUSB, etc.. > > When is planned that these packages are supported in Python 3.0? That would depend on the individual packages and their maintainers. Check their respective websit

Re: Python 2.6 for Windows 64-bit AMD

2009-05-30 Thread Martin v. Löwis
> Can anyone shed any light on what's up with this build of Python > 2.6.2? You probably tried to install the 32-bit version of PyParsing; this cannot work with the 64-bit version of Python. You either need to obtain a 64-bit version of pyparsing, or install the 32-bit version of Python. HTH, Mar

Re: Python 2.6 for Windows 64-bit AMD

2009-05-30 Thread Terry Reedy
dineshv wrote: I upgraded from Python 2.5.4 to Python 2.6.2 under the Windows 64-bit AMD version, but no external libraries (eg. pyparsing and Numpy 1.3) work. I noticed a few odd things: i. pyparsing could not find an entry for Python 2.6.2 in the Wondows Registry I suspect that you did not

Re: Python 2.6, File read() problems in Windows Xp

2009-05-08 Thread Li Wang
> (my smtp mail server has been down for a few hours, so you have some other > responses.) > > yes, as far as I can tell from the docs, the 'b' flag doesn't matter in > Unix/Linux. Note that I haven't actually been on a Unix machine since > starting with Python, but it matches what else I know. A

Re: Python 2.6, File read() problems in Windows Xp

2009-05-08 Thread Li Wang
2009/5/8 : > On May 8, 5:08 am, Li Wang wrote: >> Hi Dave: >> Thank you very much for you explanation:) >> >> > Chances are you forgot the "b" parameter to open(). Unnecessary in Unix, >> > it >> > tells the library to *not* translate \r\n to \n upon read, or the inverse >> > on write. In ot

Re: Python 2.6, File read() problems in Windows Xp

2009-05-08 Thread Li Wang
2009/5/8 Scott David Daniels : > Li Wang wrote: >> >> So, if I am using python in Linux, do open('file', 'r') and >> open('file', 'rb') work the same way? > > You get identical results, but you ar lying to the reader of your code. > you should include the 'b' if what you want is bytes (or octets if

Re: Python 2.6, File read() problems in Windows Xp

2009-05-08 Thread Scott David Daniels
Li Wang wrote: So, if I am using python in Linux, do open('file', 'r') and open('file', 'rb') work the same way? You get identical results, but you ar lying to the reader of your code. you should include the 'b' if what you want is bytes (or octets if you prefer), and not use it if what you exp

Re: Python 2.6, File read() problems in Windows Xp

2009-05-08 Thread pruebauno
On May 8, 5:08 am, Li Wang wrote: > Hi  Dave: > Thank you very much for you explanation:) > > > Chances are you forgot the "b" parameter to open().  Unnecessary in Unix, it > > tells the library to *not* translate \r\n  to \n upon read, or the inverse > > on write.  In other words, with the "b" pa

  1   2   3   >