Any possible type alias that can also set a default value for a function arg?

2023-10-18 Thread Matthew Carruth via Python-list
We have the `Optional[T]` type as a short-hand for Union[T | None] and telling us that said argument may not be present. However, I find that a majority of the time, we also want to set a default value of None on the argument so that it can be evaluated without doing a getattr() check first. i

Re: Tkinter not working

2022-08-01 Thread Matthew Barnett
On 01/08/2022 13:17, Daniel Lee wrote: Hello, I my code with tkinter was working before, and now, it has many errors in it. I’m not sure what has happened. The results after running are below: "D:\Python Projects\tes\venv\Scripts\python.exe" "D:/Python Projects/tes/main.py" Traceback (most rec

Repair Install of 64 bit python

2021-04-15 Thread Dodson, Matthew
Hi, Having an issue after installing 64 bit python. Can't pip install any packages. Get the error "No module named pip". Thanks, Matt Matthew Dodson 2020 Data Analytics/Video Intern New York Football Giants Quest Diagnostics Training Center 1925 Giants Drive East Rutherford,

Complaints on installing packages

2020-01-13 Thread ofomi matthew
Good day Python Team, I'm Matt by name and I have been having difficulties in installing packages on my pycharm.it keeps telling me "error installing package". Please how do I rectify this issues step by step. Looking forward to get a response as soon as possible. Thank you -- https://mail.python.

Sub-Org Applications for GSoC 2019 due soon!

2019-01-27 Thread Matthew Lagoe
The PSF GSoC page is http://python-gsoc.org/ That has contact information and answers to questions like "what does it take to be a mentor?" and please feel free to ask if there's more you want to know! Thank you! Matthew Lagoe -- https://mail.python.org/mailman/listinfo/python-list

Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread Matthew Lemon
If the OP was able to take the time to familiarise himself with the technologies, rather than bemoan the difficulty of deploying a ten year old code-base without mininal effort, he might have some success. Code rot is an issue after weeks sometimes, never mind ten years, and Python deployment is

Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-08 Thread Matthew Lemon
Hi, I would start from scratch with this. 1. You have latest Python 2 version. 2. Use virtualenv to create and activate a new virtual environment. 3. pip install wxPython and other dependencies. 4. Get your application running from the command line first and follow up any DLL exceptions. 5. Use

Re: Python path and append

2016-04-19 Thread Matthew Barnett
On 2016-04-19 23:38, Chris Angelico wrote: On Wed, Apr 20, 2016 at 8:29 AM, Seymore4Head wrote: handle = open("\\Winmx\New$\q.txt") for line in handle: line=line.strip() print line Traceback (most recent call last): File "\\Winmx\New$\add viewed.py", line 2, in handle = open("

I need help

2016-03-26 Thread matthew thiel
So I downloaded python and made an account but when I run it all it does is give me 3 options repair modify and uninstall I have clicked repair and modify and let them run but at the end it just exit out so how do I get it to work??? Sent from Mail

Re: Writing list of dictionaries to CSV

2015-05-05 Thread Matthew Ruffalo
On 2015-05-05 14:25, Skip Montanaro wrote: > More likely, viewing the CSV file in Excel, Gnumeric, or some other > spreadsheet which interprets some inputs as dates and formats them > according to its default rules. Skip This is depressingly common, and I've even received CSV and plain text data

Re: Great Math Mystery

2015-04-16 Thread Matthew Barnett
Do you mean Pythonesque or Pythonic?-- https://mail.python.org/mailman/listinfo/python-list

Re: Lockfile hanling

2015-03-31 Thread Matthew Ruffalo
On 2015-03-31 10:50, Ervin Hegedüs wrote: > there is an app, written in Python, which stores few bytes of > datas in a single file. The application uses threads. Every > thread can modify the file, but only one at a time. I'm using a > lock file to prevent the multiple access. > > ... > > How can I

Re: building c extensions with setuptools that are not tied to python installed on build machine

2015-02-12 Thread Matthew Taylor
Ned, thank you for your insight on this problem. I will take your advice and do some more digging. You've been very helpful. Regards, - Matt Taylor OS Community Flag-Bearer Numenta On Wed, Feb 11, 2015 at 4:23 PM, Ned Deily wrote: > In article > , > Matthew Taylor

building c extensions with setuptools that are not tied to python installed on build machine

2015-02-11 Thread Matthew Taylor
Hello pythonistas, This is my first message to this mailing list, so if my question is off-topic, please direct me to the correct mailing list. I manage the NuPIC [1] open source machine intelligence project, which is a python project with C extensions. We have a build on Travis-CI [2] that creat

Re: Python 3.x stuffing utf-8 into SQLite db

2015-02-09 Thread Matthew Ruffalo
On 02/09/2015 12:30 PM, Skip Montanaro wrote: > Thanks, Chris. Are you telling me I should have defined the input file > encoding for my CSV file as CP-1252, or that something got hosed on > the export from XLSX to CSV? Or something else? > > Skip Hi Skip- I think it's most likely that the encodi

Re: [OT] fortran lib which provide python like data type

2015-02-01 Thread Matthew Barnett
On 2015-02-02 02:04, Chris Angelico wrote: On Mon, Feb 2, 2015 at 12:59 PM, Steven D'Aprano wrote: And there are underspecified rules too. What is the plural of octopus? No fair looking it up in the dictionary. Standard and well-known piece of trivia, and there are several options. "Octopodes

Re: How to "wow" someone new to Python

2015-01-21 Thread Matthew Ruffalo
On 01/21/2015 04:26 PM, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 8:20 AM, Matthew Ruffalo wrote: >> Yes, length-unlimited strings are *extremely* useful in some >> applications. I remember bitterly cursing Java's string length limit of >> 2 ** 31 (maybe - 1) on mu

Re: How to "wow" someone new to Python

2015-01-21 Thread Matthew Ruffalo
On 01/21/2015 02:06 PM, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 5:20 AM, Irmen de Jong wrote: >> On 21-1-2015 18:59, Steve Hayes wrote: >> >>> 3. When I started to look at it, I found that strings could be any length >>> and >>> were not limited to swomething arbitrary, like 256 character

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-12 Thread Matthew Ruffalo
On 12/11/2014 09:48 PM, Terry Reedy wrote: > A possible reason: one is developing an app expected to be released > fall 2015 after the 3.5 release and the app depends on something new > in 3.5. I must admit though that I cannot think of any such thing now > for 3.5. For 3.3 there was the new unic

Re: generating unique variable name via loops

2014-11-04 Thread Matthew Ruffalo
Hi- Questions like this appear so often in various places (mailing lists, forums, sites like Stack Overflow) that I think a very blunt/candid answer is appropriate. This is especially true since there's always someone who responds to the question as-is with some monstrosity of exec() and string fo

Re: (test) ? a:b

2014-10-22 Thread Matthew Ruffalo
On 10/22/2014 12:40 PM, Chris Angelico wrote: > That's true when it's fundamentally arithmetic. But part of that > readability difference is the redundancy in the second one. What if it > weren't so redundant? > > 'Negative' if x < 0 else 'Low' if x < 10 else 'Mid' if x < 20 else 'High' > > You can

Re: No Error; No Output...Nothing

2014-10-21 Thread Matthew Ruffalo
On 10/21/2014 05:44 PM, ryguy7272 wrote: > Hey everyone, I'm trying to run this code. > > ... > > I commented out the import pylab as pl because I couldn't get the > matplotlib.pylab import working. So, anyway, I hit F5, and it seems to run, > but it doesn't really do anything. Isn't this eithe

Re: MacOS 10.9.2: threading error using python.org 2.7.6 distribution

2014-04-28 Thread Matthew Pounsett
On Sunday, 27 April 2014 10:33:38 UTC-4, Chris Angelico wrote: > In most contexts, "thread unsafe" simply means that you can't use the > same facilities simultaneously from two threads (eg a lot of database > connection libraries are thread unsafe with regard to a single > connection, as they'll

Re: MacOS 10.9.2: threading error using python.org 2.7.6 distribution

2014-04-27 Thread Matthew Pounsett
On Friday, 25 April 2014 14:58:56 UTC-4, Ned Deily wrote: > FWIW, the Python 2 version of subprocess is known to be thread-unsafe. > There is a Py2 backport available on PyPI of the improved Python 3 > subprocess module: Since that't the only thread that calls anything in subprocess, and I'm o

Re: MacOS 10.9.2: threading error using python.org 2.7.6 distribution

2014-04-27 Thread Matthew Pounsett
On Friday, 25 April 2014 10:05:03 UTC-4, Chris Angelico wrote: > First culprit I'd look at is the mixing of subprocess and threading. > It's entirely possible that something goes messy when you fork from a > thread. I liked the theory, but I've run some tests and can't reproduce the error that w

Re: Proper deletion of selected items during map iteration in for loop

2014-04-25 Thread Matthew Barnett
On 2014-04-25 18:53, Charles Hixson wrote: What is the proper way to delete selected items during iteration of a map? What I want to do is: for (k, v) in m.items(): if f(k): # do some processing of v and save result elsewhere del m[k] But this gives (as should be expected

MacOS 10.9.2: threading error using python.org 2.7.6 distribution

2014-04-25 Thread Matthew Pounsett
I've run into a threading error in some code when I run it on MacOS that works flawlessly on a *BSD system running the same version of python. I'm running the python 2.7.6 for MacOS distribution from python.org's downloads page. I have tried to reproduce the error with a simple example, but so

Is a Metaclass the appropriate way to solve this problem?

2013-08-07 Thread Matthew Lefavor
All: Like most people, I find the whole metaclass topic pretty obscure, and I have avoided trying to use one for a while. I am also aware of Tim Peter's famous advice that if you have to ask whether you need a metaclass, then you almost certainly don't. But in this case I know I am solving a probl

Re: Python Script Hashplings

2013-07-26 Thread Matthew Lefavor
> > > Thanks Matthew Lefavor! But specifically, why use "#!/usr/bin/env python3" > instead of "#!/usr/bin/python3"? > The "env" program looks up its argument in the current $PATH environment variable, and then executes that. This means you aren

Re: Is it that easy to install Python ?

2013-07-25 Thread Matthew Lefavor
On Thu, Jul 25, 2013 at 11:11 AM, wrote: > Hi there, > > I never write any Python program but as a system administrator, I'm often > asked to install python on Debian servers. > > I just finished downloading, configuring, making and installing. > > The binary is now installed in : > /usr/local/Py

Re: Python Script Hashplings

2013-07-25 Thread Matthew Lefavor
The answer is "probably not." If you just want to use the latest version of Python 3 you have installed on your system, use: "#!/usr/bin/python3". When you use the specific minor version numbers, they point to that specific minor version. Actually, the preferred shebang line is of the form: "#!/us

Re: Messages to Python-List aren't posting

2013-07-19 Thread Matthew Lefavor
Well, it seems like the last message I posted did post in time. I'll keep tabs on the issue and email the postmaster if it persists. Matthew Lefavor On Fri, Jul 19, 2013 at 11:00 AM, Chris Angelico wrote: > On Sat, Jul 20, 2013 at 12:57 AM, Skip Montanaro wrote: > >> One

Re: Messages to Python-List aren't posting

2013-07-19 Thread Matthew Lefavor
(Sorry to reply-all, but in this case I think the direct messages will get to people on this thread 12 hours earlier than the others.) Well, I have had this problem with both my work email (matthew dot lefavor _at_ nasa dpt gov) and my Gmail account. Since this doesn't happen to all users

Messages to Python-List aren't posting

2013-07-19 Thread Matthew Lefavor
ng to gmail has had no effect. Is there some obscure setting I am missing? Has anybody else had this problem? Matthew Lefavor -- http://mail.python.org/mailman/listinfo/python-list

KeyboardInterrupt in Subproccesses

2013-07-19 Thread Matthew Lefavor
All: I am maintaining a program in Python 2 and need to send it a KeyboardInterrupt to close it. Unfortunately, the program is used as a subprocess in a wrapper subprocess, and so I cannot just directly press CTL-C; I have to use a signal. When I run the program "bare" (not in a subprocess), I ha

Re: Default Value

2013-06-25 Thread Lefavor, Matthew (GSFC-582.0)[MICROTEL LLC]
> > The Apathetic Approach: > > I could just assume that a programmer is responsible for the > code he writes. If he passes mutables into a function as > default arguments, and

Re: Default Value

2013-06-25 Thread Lefavor, Matthew (GSFC-582.0)[MICROTEL LLC]
On Jun 21, 2013, at 11:17 AM, Rick Johnson wrote: > On Thursday, June 20, 2013 5:28:06 PM UTC-5, Lefavor, Matthew > (GSFC-582.0)[MICROTEL LLC] wrote: >> >> [snip example showing dummy coder doing something dumb] >> >> +1. This is what convinces me that ke

Re: Default Value

2013-06-21 Thread Lefavor, Matthew (GSFC-582.0)[MICROTEL LLC]
Or, in many MANY cases, the choice was the right one, but isn't obvious to everyone. I think it's worth pointing out that changing function defaults to late-binding would merely change the nature of the gotcha, not eliminate it. words = ("one", "two", "red", "blue", "fish") def join_strings(stri

Re: Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-17 Thread Lefavor, Matthew (GSFC-582.0)[MICROTEL LLC]
And as for launching iTunes and playing a Podcast, you should take a look at AppleScript. AppleScript is designed specifically for running and controlling Mac OS X applications—iTunes among them. (I once wrote a script to sync my iTunes play counts from last.fm, for example.) You might also loo

Building a HPC data assimilation system using Python?

2013-05-29 Thread Matthew Francis
I have a prototype data assimilation code ( an ionospheric nowcast/forecast model driven by GPS data ) that is written in IDL (interactive data language) which is a horrible language choice for scaling the application up to large datasets as IDL is serial and slow (interpreted). I am embarking

Re: Non-identifiers in dictionary keys for **expression syntax

2013-05-23 Thread Matthew Gilson
On 05/23/2013 04:52 PM, Terry Jan Reedy wrote: On 5/23/2013 2:52 PM, Matthew Gilson wrote: This is a question regarding the documentation around dictionary unpacking. The documentation for the call syntax (http://docs.python.org/3/reference/expressions.html#grammar-token-call) says: "I

Re: Non-identifiers in dictionary keys for **expression syntax

2013-05-23 Thread Matthew Gilson
On 05/23/2013 03:20 PM, Neil Cerutti wrote: On 2013-05-23, Matthew Gilson wrote: That's fine, but what is a keyword argument? According to the glossary (http://docs.python.org/3.3/glossary.html): /"keyword argument/: an argument preceded by an identifier (e.g. name=) in a functi

Non-identifiers in dictionary keys for **expression syntax

2013-05-23 Thread Matthew Gilson
This is a question regarding the documentation around dictionary unpacking. The documentation for the call syntax (http://docs.python.org/3/reference/expressions.html#grammar-token-call) says: "If the syntax **expression appears in the function call, expression must evaluate to a mapping, th

Re: Pythonic way to count sequences

2013-04-25 Thread Matthew Gilson
A Counter is definitely the way to go about this. Just as a little more information. The below example can be simplified: from collections import Counter count = Counter(mylist) With the other example, you could have achieved the same thing (and been backward compatible to python2.

Re: Feature Request: `operator.not_in`

2013-04-19 Thread Matthew Gilson
On 4/19/13 2:27 PM, Terry Jan Reedy wrote: On 4/19/2013 10:27 AM, Matthew Gilson wrote: ) It seems to me that the operator module should have a `not_in` or `not_contains` function. It seems asymmetric that there exists a `is_not` function which implements `x is not y` but there isn

Feature Request: `operator.not_in`

2013-04-19 Thread Matthew Gilson
I believe that I read somewhere that this is the place to start discussions on feature requests, etc. Please let me know if this isn't the appropriate venue (and what the appropriate venue would be if you know). This request has 2 related parts, but I think they can be considered seperately:

Re: Missing logging output in Python

2013-03-12 Thread W. Matthew Wilson
NFO messages to sys.stderr > console = logging.StreamHandler() > console.setLevel(logging.INFO) > # set format that is cleaber for console use > formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') > # tell the handler to use this format >

Any logger created before calling logging.config.dictCOnfig is not configured

2013-03-06 Thread W. Matthew Wilson
t "log.root.level: {0}".format(log1.root.level) print "log.root.handlers: {0}".format(log1.root.handlers) print "log1.parent.level: {0}".format(log1.parent.level) print "log1.parent.handlers: {0}".format(log1.parent.handlers) print "log1.level: {0}".format(log1.level) print "log1.handlers: {0}".format(log1.handlers) print "log1.propagate: {0}".format(log1.propagate) print "log1.getEffectiveLevel(): {0}".format(log1.getEffectiveLevel()) ### SCRIPT END -- W. Matthew Wilson m...@tplus1.com http://tplus1.com -- http://mail.python.org/mailman/listinfo/python-list

Legal: Introduction to Programming App

2012-08-19 Thread Matthew Zipf
to recognize the Python Software Foundation in my app? Thank you, Matthew Zipf -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting started with IDLE and Python - no highlighting and no execution

2012-08-05 Thread Matthew Barnett
On 06/08/2012 01:58, MRAB wrote: On 06/08/2012 01:09, Rotwang wrote: On 06/08/2012 00:46, PeterSo wrote: I am just starting to learn Python, and I like to use the editor instead of the interactive shell. So I wrote the following little program in IDLE # calculating the mean data1=[49, 66, 24,

Re: [pyxl] xlrd 0.8.0 released!

2012-08-01 Thread Matthew Smith
ribed to the Google Groups > "python-excel" group. > To post to this group, send an email to python-ex...@googlegroups.com. > To unsubscribe from this group, send email to python-excel+unsubscribe@** > googlegroups.com . > For more options, visit this group at http://groups.go

Re: something go wrongly

2012-07-08 Thread Lefavor, Matthew (GSFC-582.0)[MICROTEL LLC]
If you do want an in-place extension, you could try: aList=[1,2,3,4,5,6,7,8,9,10] xList=[1,2,3] print "The concatenated lists are:", aList + bList Though you need to remember that neither aList nor bList is altered in this situation! Matthew Lefavor NASA GSFC [Microtel, LLC] Mail

Re: Two questions about logging

2012-01-14 Thread Matthew Pounsett
On Jan 12, 8:03 pm, K Richard Pixley wrote: > Here's the confusion.  Each log named __name__ is under the root logger. >   If you want them all, then catch them all with the root logger. Thanks! I knew I was missing something obvious. Between you and Jean- Michael Pichavant I've figured out wha

Re: Two questions about logging

2012-01-11 Thread Matthew Pounsett
On Jan 11, 9:34 pm, Roy Smith wrote: > What I would do is log to syslog (logging.handlers.SysLogHandler) and > let syslog worry about rotating log files.  Why reinvent the wheel? Syslog is fine for an application run by an administrator, but isn't an option for a user. -- http://mail.python.org/

Two questions about logging

2012-01-11 Thread Matthew Pounsett
I'm trying to figure out a couple of things with the logging module, and I'm hoping someone can provide some pointers. I've read through the module docs on python.org, the basic and advanced tutorials, and the cookbook post, but a couple of things still elude me. First, I'd like to be able to per

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Matthew Lenz
Another thing I noticed is that the & and | appear to give the same result as adding or subtracting 128 from the ordinal value. I'm assuming that isn't coincidence. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Matthew Lenz
Thanks, this will be a great help. Just wanted to confirm that you meant to use [ .. for x in ord_str] in the example conversion? Got a TypeError using the received_str. -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Matthew Lenz
Ahh. Ok. So how would I go about doing that with python? I think in perl (sorry for the naughty word) I could use the tr// (translate) but is there a quick way to do so with python? Is it going to be necessary to convert commands I SEND to the device or only convert what I receive? -- http:/

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Matthew Lenz
Using 8N1 under minicom with this device resulted in garbled text when once connected. Connection using 7M1 resulted in the correct text. So there must be something else that needs to be done in my python program correct? -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-POSIX parity (mark/space) with Python-Serial on Linux.

2011-11-21 Thread Matthew Lenz
I should also note that I am aware of the following discussion on the newsgroup: https://groups.google.com/d/msg/comp.lang.python/1HyCqPSOf50/eQINFrrFKwoJ However, I believe this refers to implementing the solution for 8M1 and 8S1. -- http://mail.python.org/mailman/listinfo/python-list

Re: cause __init__ to return a different class?

2011-09-18 Thread Matthew Pounsett
On Sep 15, 1:54 am, Ryan Kelly wrote: > To be friendlier to others reading your code, I would consider using a > classmethod to create an alternative constructor: I finally got back to looking at this today. As it turns out, un- overriding __new__ in the child class is more complicated than I fi

Re: cause __init__ to return a different class?

2011-09-15 Thread Matthew Pounsett
On Sep 15, 1:54 am, Ryan Kelly wrote: > The above will do exactly what you want, but it's generally bad style > unless you have a very specific use-case.  Is there a particular reason > you need to "magically" return a subclass, rather than making this > explicit in the code? > > To be friendlier

Re: cause __init__ to return a different class?

2011-09-15 Thread Matthew Pounsett
On Sep 15, 1:35 am, Chris Rebert wrote: > Override __new__() instead: > http://docs.python.org/reference/datamodel.html#object.__new__ Aha.. thanks! The reference book I'm working from neglects to mention __new__, so I'd assumed __init__ was the constructor. It hadn't occurred to me that python

cause __init__ to return a different class?

2011-09-14 Thread Matthew Pounsett
I'm wondering if there's a way in python to cause __init__ to return a class other than the one initially specified. My use case is that I'd like to have a superclass that's capable of generating an instance of a random subclass. I've tried both returning the subclass (as I would when overloa

Re: Error when deleting and reimporting subpackages

2011-08-22 Thread Matthew Brett
On Monday, August 22, 2011 12:06:44 PM UTC-7, Stephen Hansen wrote: > On 8/22/11 11:51 AM, Matthew Brett wrote: > > Hi, > > > > I recently ran into this behavior: > > > >>>> import sys > >>>> import apkg.subpkg > >>>> d

Error when deleting and reimporting subpackages

2011-08-22 Thread Matthew Brett
into this because the nose testing framework does exactly this kind of thing when loading test modules, causing some very confusing errors and failures. Is this behavior expected? Best, Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble installing MySQLdb (cygwin) + Bonus question

2011-01-25 Thread Matthew Roth
On Jan 25, 6:20 pm, David Robinow wrote: > On Tue, Jan 25, 2011 at 5:59 PM, Matthew Roth wrote: > > On Jan 25, 9:34 pm, John Nagle wrote: > ... > >>     You can install a MySQL server under Windows, and talk to the server > >> from the Cygwin environment

Re: trouble installing MySQLdb (cygwin) + Bonus question

2011-01-25 Thread Matthew Roth
On Jan 25, 9:34 pm, John Nagle wrote: > On 1/25/2011 7:05 AM, Matthew Roth wrote: > > > On Jan 25, 4:30 am, Dennis Lee Bieber  wrote: > >> On Mon, 24 Jan 2011 14:25:09 -0800 (PST), Matthew Roth > >>  declaimed the following in > >> gmane.comp.python.gene

Re: trouble installing MySQLdb (cygwin) + Bonus question

2011-01-25 Thread Matthew Roth
Thank you. I appreciate you explanation and tolerance of my ignorance. However unfortunate, this still does not solve my major issue. -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble installing MySQLdb (cygwin) + Bonus question

2011-01-25 Thread Matthew Roth
On Jan 25, 4:30 am, Dennis Lee Bieber wrote: > On Mon, 24 Jan 2011 14:25:09 -0800 (PST), Matthew Roth > declaimed the following in > gmane.comp.python.general: > > > > > I've explored various avenues all day to no avail. Can anyone offer a > > solution or a di

trouble installing MySQLdb (cygwin) + Bonus question

2011-01-24 Thread Matthew Roth
Hi, I'm a python newbie. By newbie I mean two days ago. It was suggested to me that I work with python. Unfortunately at work I must run this on a windows machiene. However, I am having difficultly installing MySQLdb. First is it even possible under my current environment? I am using python(2.6.5

Re: loading configuration files that are themselves python

2010-07-03 Thread Matthew Vernon
Peter Otten <__pete...@web.de> writes: > Matthew Vernon wrote: > > > Is there a more idiomatic way of loading in a configuration file > > that's python code than: > > > > _temp=__import__(path,fromlist='cachestrs') > > cachestrs=_tem

loading configuration files that are themselves python

2010-07-03 Thread Matthew Vernon
th' is a variable defined elsewhere TIA, Matthew -- Rapun.sel - outermost outpost of the Pick Empire http://www.pick.ucam.org -- http://mail.python.org/mailman/listinfo/python-list

Re: indexing lists/arrays question

2010-05-13 Thread Matthew Wilson
On Thu 13 May 2010 10:36:58 AM EDT, a wrote: > this must be easy but its taken me a couple of hours already > > i have > > a=[2,3,3,4,5,6] > > i want to know the indices where a==3 (ie 1 and 2) > > then i want to reference these in a > > ie what i would do in IDL is > > b=where(a eq 3) > a1=a(b)

Need help using callables and setup in timeit.Timer

2010-05-12 Thread Matthew Wilson
I want to time some code that depends on some setup. The setup code looks a little like this: >>> b = range(1, 1001) And the code I want to time looks vaguely like this: >>> sorted(b) Except my code uses a different function than sorted. But that ain't important right now. Anyhow, I

How to measure speed improvements across revisions over time?

2010-05-10 Thread Matthew Wilson
I know how to use timeit and/or profile to measure the current run-time cost of some code. I want to record the time used by some original implementation, then after I rewrite it, I want to find out if I made stuff faster or slower, and by how much. Other than me writing down numbers on a piece o

Re: zlib.decompress fails, zlib.decompressobj succeeds - bug or feature?

2010-05-09 Thread Matthew Brett
python.org? I will - thanks for your advice, Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: zlib.decompress fails, zlib.decompressobj succeeds - bug or feature?

2010-05-09 Thread Matthew Brett
l? But, no, d.flush() returns the empty string after decompressing ``data``. Thanks again, Matthew -- http://mail.python.org/mailman/listinfo/python-list

zlib.decompress fails, zlib.decompressobj succeeds - bug or feature?

2010-05-09 Thread Matthew Brett
ecompressobj().decompress(data) I get a usable uncompressed string. I was expecting these two calls to do the same thing. Is that expectation right? If not, is there somewhere I could find out why? Thanks a lot, Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: off topic but please forgive me me and answer

2010-04-03 Thread Matthew Barnett
superpollo wrote: Steve Holden ha scritto: superpollo wrote: Patrick Maupin ha scritto: On Apr 2, 2:41 pm, Andreas Waldenburger wrote: While everyone else is mocking you: Can you please elaborate on why you want to know and what kind of problem you're trying to solve with this? Also, don'

Re: Are there in Python some static web site generating tools like webgen, nanoc or webby in Ruby ?

2010-03-09 Thread Matthew Behrens
> I like this tools, I'm wonder if there are similar tools in Python ? Blogofile is a static file blog engine/compiler, inspired by Jekyll. http://blogofile.com/ http://github.com/EnigmaCurry/blogofile -- http://mail.python.org/mailman/listinfo/python-list

Re: Download unnamed web image?

2010-02-16 Thread Matthew Barnett
galileo228 wrote: On Feb 16, 9:40 pm, galileo228 wrote: On Feb 16, 8:48 pm, John Bokma wrote: galileo228 writes: Using BeautifulSoup, mechanize, and urllib, I've constructed the following: br.open("http://www.school.edu/students/facebook/";) br.select_form(nr = 1) br.form['fulltextsearch

Re: ANN: obfuscate

2010-02-11 Thread Matthew Barnett
Paul Rubin wrote: Gregory Ewing writes: Actually I gather it had a lot to do with the fact that the Germans made some blunders in the way they used the Enigma that seriously compromised its security. There was reportedly a branch of the German forces that used their Enigmas differently, avoidin

Re: EAFP gone wrong

2010-02-09 Thread Matthew Barnett
Arnaud Delobelle wrote: Hi all, Hi have a set of classes that represent mathematical objects which can be represented as a string using a 'latex' method (after Knuth's famous typesetting system). As I want to be able to typeset some builtin types as well, I have a generic function, latex(), as

Re: syntax

2010-01-18 Thread Matthew Barnett
marlowe wrote: I wrote this program, but i have a feeling like there might be a more practical way of writing it. Can someone give me an idea of how to simplify this? Here is an example of the csv file i am using. This program calculates the exponential moving average of the 20 day range. USOtab

Re: What is built-in method sub

2010-01-11 Thread Matthew Barnett
Jeremy wrote: I just profiled one of my Python scripts and discovered that >99% of the time was spent in {built-in method sub} What is this function and is there a way to optimize it? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: getopt not raising exception

2010-01-10 Thread Matthew Lear
Matt Nordhoff wrote: > BTW: Checked out optparse? It's bigger and sexier! Thanks for the tip. Works a treat. -- Matt -- http://mail.python.org/mailman/listinfo/python-list

getopt not raising exception

2010-01-10 Thread Matthew Lear
Hello, I'm having problems getting getopt to function correctly. Basically, no exception is being raised if no argument is passed to the code snippet below. I've read the Python documentation and tried example code from various sources which should cause an exception, only they don't. I've also tr

Re: 3 byte network ordered int, How To ?

2010-01-06 Thread Matthew Barnett
mudit tuli wrote: For a single byte, struct.pack(') For two bytes, struct.pack(') what if I want three bytes ? Four bytes and then discard the most-significant byte: struct.pack(')[ : -1] -- http://mail.python.org/mailman/listinfo/python-list

Re: KeyboardInterrupt

2009-12-10 Thread Matthew Barnett
mattia wrote: Il Thu, 10 Dec 2009 04:56:33 +, Brad Harms ha scritto: On Thu, 10 Dec 2009 00:29:45 +, mattia wrote: Il Wed, 09 Dec 2009 16:19:24 -0800, Jon Clements ha scritto: On Dec 9, 11:53 pm, mattia wrote: Hi all, can you provide me a simple code snippet to interrupt the execu

Matthew Joiner wants to stay in touch on LinkedIn

2009-11-12 Thread Matthew Joiner
LinkedIn Matthew Joiner requested to add you as a connection on LinkedIn: -- Jaime, I'd like to add you to my professional network on LinkedIn. - Matthew Joiner Accept invitation from Matthew Joiner http://www.linkedin.

creating a slide show in JES

2009-10-15 Thread Matthew manzo
I need to create a slideshow in JES but am not sure how to do it. Can anyone help me with this. How do i create a slideshow that has a song and then two images where one image begins then the second image slowly blends in and takes over the first image? -- h

How do I begin debugging a python memory leak?

2009-09-16 Thread Matthew Wilson
I have a web app based on TurboGears 1.0. In the last few days, as traffic and usage has picked up, I noticed that the app went from using 4% of my total memory all the way up to 50%. I suspect I'm loading data from the database and somehow preventing garbage collection. Are there any tools that

Question about unpickling dict subclass with custom __setstate__

2009-09-10 Thread Matthew Wilson
I subclassed the dict class and added a __setstate__ method because I want to add some extra steps when I unpickle these entities. This is a toy example of what I am doing: class Entity(dict): def __setstate__(self, d): log.debug("blah...") Based on my experiments, the

Re: How to refer to data files without hardcoding paths?

2009-09-08 Thread Matthew Wilson
On Mon 07 Sep 2009 10:57:01 PM EDT, Gabriel Genellina wrote: > I prefer > to use pkgutil.get_data(packagename, resourcename) because it can handle > those cases too. I didn't know about pkgutil until. I thought I had to use setuptools to do that kind of stuff. Thanks! Matt -- http://mail.pyth

How to refer to data files without hardcoding paths?

2009-09-05 Thread Matthew Wilson
When a python package includes data files like templates or images, what is the orthodox way of referring to these in code? I'm working on an application installable through the Python package index. Most of the app is just python code, but I use a few jinja2 templates. Today I realized that I'm

Re: An assessment of the Unicode standard

2009-09-01 Thread Matthew Barnett
Kurt Mueller wrote: Am 01.09.2009 um 09:39 schrieb Terry Reedy: But this same problem also extends into monies, nation states, units of measure, etc. There is, of course, an international system of measure. The US is the only major holdout. (I recall Burma, or somesuch, is another.) An inte

Re: Most "active" coroutine library project?

2009-08-23 Thread Matthew Woodcraft
Phillip B Oldham writes: > I've been taking a look at the multitude of coroutine libraries > available for Python, but from the looks of the projects they all seem > to be rather "quiet". I'd like to pick one up to use on a current > project but can't deduce which is the most popular/has the larg

Re: Annoying octal notation

2009-08-23 Thread Matthew Woodcraft
Dennis Lee Bieber writes: > About the only place one commonly sees leading zeros on decimal > numbers, in my experience, is zero-filled COBOL data decks (and since > classic COBOL stores in BCD anyway... binary (usage is > computational/comp-1) was a later add-on to the data specification mo

Re: better way?

2009-08-11 Thread Matthew Woodcraft
"Rami Chowdhury" writes: > IIRC Postgres has had ON DUPLICATE KEY UPDATE functionality longer than > MySQL... PostgreSQL does not have ON DUPLICATE KEY UPDATE. The SQL standard way to do what the OP wants is MERGE. PostgreSQL doesn't have that either. -M- -- http://mail.python.org/mailman/lis

  1   2   3   4   5   >