I'm on OS X, and I cannot get Python to import modules I've saved. I
have created the the environment.plist file and appended it with my
desired module path. If I print sys.path from the interpreter, my new
path does indeed show up as the first listing, yet any attempt at
importing modules from
Hm, so if I import glob, and then execute this line:
print glob.glob('/Local_HD/Users/mike/Documents/pythonModules/*.py')
I simply get brackets returned:
[]
...not sure what this means. Thanks again.
On Feb 14, 2005, at 5:41 PM, Danny Yoo wrote:
On Mon, 14 Feb 2005, Mike Hall wrot
Ok, I've got it working. The environment.plist file wants a path
beginning with /Users, not /Local_HD. So simple! Thanks everyone.
On Feb 14, 2005, at 6:26 PM, David Rock wrote:
* Mike Hall <[EMAIL PROTECTED]> [2005-02-14 18:22]:
Hm, so if I import glob, and then execute this
I'm seeing it used in a Python/Applescript tutorial, though am unclear
on it's exact purpose or usage. Can someone fill me in?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I'd like to get a match for a position in a string preceded by a specified word (let's call it "Dog"), unless that spot in the string (after "Dog") is directly followed by a specific word(let's say "Cat"), in which case I want my match to occur directly after "Cat", and not "Dog."
I can easily get
; x1 = re.compile(r'(dog)(cat)?')
>>> rep1 = x1.sub("REPLACE", str1)
>>> rep2 = x2.sub("REPLACE", str2)
>>> print rep1
The REPLACE chased the car
>>> print rep2
The REPLACE cat parade was under way
...what I'm looking for is a matc
:
(?<=cat)
...but ONLY if "cat" is following "dog." If "dog" does not have "cat"
following it, then I simply want this:
(?<=dog)
...if that makes sense :) thanks.
On Mar 8, 2005, at 6:05 PM, Danny Yoo wrote:
On Tue, 8 Mar 2005, Mike Hall wrote:
I
Sorry, my last reply crossed this one (and yes, I forgot again to CC
the list).
I'm experimenting now with your use of the "or" operator( "|") between
two expressions, thanks.
On Mar 8, 2005, at 6:42 PM, Danny Yoo wrote:
On Tue, 8 Mar 2005, Mike Hall wrote:
Yes, my
I'm having some strange results using the "or" operator. In every test
I do I'm matching both sides of the "|" metacharacter, not one or the
other as all documentation says it should be (the parser supposedly
scans left to right, using the first match it finds and ignoring the
rest). It should
Indeed I do:
>>> import re
>>> x = re.compile('A|B')
>>> s = " Q A R B C"
>>> r = x.sub("13", s)
>>> print r
Q 13 R 13 C
On Mar 9, 2005, at 12:09 PM, Liam Clarke wrote:
Hi Mike,
Do you get the same results for a se
should be
(A) | (^B)
Hope it helps!
On Wed, 9 Mar 2005 11:11:57 -0800, Mike Hall
<[EMAIL PROTECTED]> wrote:
I'm having some strange results using the "or" operator. In every
test
I do I'm matching both sides of the "|" metacharacter, not one or the
other a
u can limit substitutions using an optional argument, but yeah, it
seems you're expecting it to examine the string as a whole.
Check out the example here -
http://www.amk.ca/python/howto/regex/
regex.html#SECTION00032
Also
http://www.regular-expressions.info/alternation.html
Reg
I'm having trouble getting re to stop matching after it's consumed what I want it to. Using this string as an example, the goal is to match "CAPS":
>>> s = "only the word in CAPS should be matched"
So let's say I want to specify when to begin my pattern by using a lookbehind:
>>> x = re.compile
,
Liam Clarke
On Wed, 16 Mar 2005 12:12:32 -0800, Mike Hall
<[EMAIL PROTECTED]> wrote:
I'm having trouble getting re to stop matching after it's consumed
what
I want it to. Using this string as an example, the goal is to match
"CAPS":
s = "only the word in CAPS should
On Mar 16, 2005, at 5:32 PM, Sean Perry wrote:
I know this does not directly help, but I have never successfully used
\b in my regexs. I always end up writing something like foo\s+bar or
something more intense.
I've had luck with the boundary flag in relation to lookbehinds. For
example, if I wa
005, at 8:00 PM, Christopher Weimann wrote:
On 03/16/2005-12:12PM, Mike Hall wrote:
I'm having trouble getting re to stop matching after it's consumed
what I want it to. Using this string as an example, the goal is to
match "CAPS":
s = "only the word in CAPS should be matched"
On Mar 16, 2005, at 8:32 PM, Kent Johnson wrote:
"in (.*?)\b" will match against "in " because you use .* which will
match an empty string. Try "in (.+?)\b" (or "(?<=\bin)..+?\b" )to
require one character after the space.
Another working example, excellent. I'm not too clear on why the back
to
I don't have that script on my system, but I may put pythoncard on here
and run it through that:
http://pythoncard.sourceforge.net/samples/redemo.html
Although regexPlor looks like it has the same functionality, so I may
just go with that. Thanks.
On Mar 17, 2005, at 1:31 AM, Michael Dunn wrote
On Mar 17, 2005, at 11:11 AM, Kent Johnson wrote:
The first one matches the space after 'in'. Without it the .+? will
match the single space, then \b matches the *start* of the next word.
I think I understand. Basically the first dot advances the pattern
forward in order to perform a non-greedy m
On Mar 18, 2005, at 9:27 AM, Christopher Weimann wrote:
On 03/17/2005-10:15AM, Mike Hall wrote:
Very nice sir. I'm interested in what you're doing here with
the caret metacharacter. For one thing, why enclose it and the
whitespace flag within a character class?
A caret as
On Mar 18, 2005, at 1:02 PM, Christopher Weimann wrote:
On 03/18/2005-10:35AM, Mike Hall wrote:
A caret as the first charachter in a class is a negation.
So this [^\s]+ means match one or more of any char that
isn't whitespace.
Ok, so the context of metas change within a class. That makes
Unless I'm mistaken .readlines() is supposed to return a list, where
each index is a line from the file that was handed to it. Well I'm
finding that it's putting more than one line of my file into a single
list entry, and separating them with \r. Surely there's a way to have a
one to one correl
.readlines()
Or try:
x = file(myFile, 'rU')
for line in x:
#do stuff
Let us know how that goes.
Regards,
Liam Clarke
PS
Worse come to worse, you could always do -
x = file(myFile, 'r').read()
listX = x.split('\r')
On Tue, 22 Mar 2005 17:10:43 -0800, Mi
On Mar 23, 2005, at 12:53 AM, Alan Gauld wrote:
Typically what happens is you view the file in an application
that autrowraps long lines so it looks like multiple lines on
screen but in fact it is one long line in the file. In that
case Python will only see the single long line.
I'm using subEthaEd
On Mar 23, 2005, at 3:17 AM, Kent Johnson wrote:
Anyway, Mike, it seems clear that your file has line endings in it
which are not consistent with the default for your OS. If reading with
universal newlines doesn't solve the problem, please let us know what
OS you are running under and give more
I'm curious on whether or not JavaScript and Python can talk to each
other. Specifically, can a python function be called from within a JS
function? Admittedly this is probably more of a JavaScript than Python
question, but I'd love to know if anyone can at least point me in a
direction to res
done, but I imagine there are
other ways.
Thanks,
Ryan
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Mike Hall
Sent: Friday, March 25, 2005 2:18 PM
To: tutor@python.org
Subject: [Tutor] Python and Javascript
I'm curious on whether or not JavaScri
On Mar 25, 2005, at 12:41 PM, Alan Gauld wrote:
If you are using WSH on Windows and have the Python active scripting
installed then yes. Similarly if you use IE as web browser then it
can be done in a web page too.
I'm on OSX, and would be doing this through Safari most likely.
-MH
___
On Mar 25, 2005, at 1:00 PM, Ryan Davis wrote:
Ok, that explains a lot, but I don't know of any easy way to do have
javascript talk to python.
I can think of some horrible ways to do it, though.
1. Make a python web service running locally, and build up SOAP calls
or HTTP posts to it. (same as I
Danny, great reply. I have looked a bit at pyObjC, and it does indeed
look cool. I was however hoping to bypass that route altogether and go
for the simplicity (I thought) that came with the html/js route.
Perhaps a cocoa bundle is the only way to get what I'm after. Thanks,
-MH
On Mar 25, 2005
On Mar 25, 2005, at 4:53 PM, Alan Gauld wrote:
intrigued by Dashboard, which will be in the next OSX release. It
allows you to create "widgets" which are essentially little html
pages
There is an API for Dashboard and I'm pretty sure MacPython will
support it - it covers most of the cocoa type stuf
I looked over the global module index and the closest thing I could find relating to my os (osx) was EasyDialogs, which has a few functions pertaining to this, "AskFileForOpen()" being one. Calling any function within EasyDialogs however yields an Apple Event error:
AE.AEInteractWithUser(5000)
On Mar 28, 2005, at 4:24 PM, [EMAIL PROTECTED] wrote:
So, you are writing a GUI app and you want some kind of open file
dialog? Won't
this depend on what toolkit you are using for your GUI?
If you are using Tkinter (which should work on OS X, I think), try:
import tkFileDialog
f = tkFileDialog.a
On Mar 31, 2005, at 12:21 AM, Max Noel wrote:
It's been too long since I used Python on MacOSX, but IIRC you can't
just run a Python GUI program from the shell. Or something like
that...you should ask this one on the python-mac SIG mailing list:
http://www.python.org/sigs/pythonmac-sig/
Kent
Yo
Ah, so it has to do with access to the window manager. That answers a
lot, thanks.
On Mar 31, 2005, at 4:09 PM, Max Noel wrote:
On Apr 1, 2005, at 00:14, Mike Hall wrote:
On Mar 31, 2005, at 12:21 AM, Max Noel wrote:
It's been too long since I used Python on MacOSX, but IIRC you
can'
On Apr 1, 2005, at 4:12 PM, Jeff Shannon wrote:
At the OS level, these two actions are *completely* different. The
webbrowser module launches an entirely separate program in its own
independent process, where the "file browser" is opening a standard
dialog inside of the current process and depende
You can chop off anything past 72 characters with:
s2 = s[:72]
On Apr 4, 2005, at 7:04 AM, Vines, John (Civ, ARL/CISD) wrote:
Hello. I have a question regarding strings. How do I format a string
to be a specific length?
For example I need 'string1' to be 72 characters long.
Thanks for your time,
Does anyone know of a Python debugger that will run under OSX 10.4? The Eric debugger was looked at, but it's highly unstable under Tiger. Thanks.-MH___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I should of specified that I'm looking for an IDE with full
debugging. Basically something like Xcode, but with Python support.
On May 18, 2005, at 3:10 PM, [EMAIL PROTECTED] wrote:
> Quoting Mike Hall <[EMAIL PROTECTED]>:
>
>
>> Does anyone know of a Python debugg
Great recommendation, thanks.-MHOn May 18, 2005, at 8:12 PM, Lee Cullens wrote:Mike,You may not be looking for a commercial IDE, but I am very happy with WingIDE and using it with Tiger.Lee COn May 18, 2005, at 6:54 PM, Mike Hall wrote: I should of specified that I'm looking for an IDE
40 matches
Mail list logo