I'm on Windows, but I think you need the shebang thing at the top of
your script, right?
Then, put whatever you want to import in a script or module called
testmod.py.
Then you should be able to import either into a script or at the
command line using simply:
import testmod
If it doesn't work
It's not that, it looks like __import__looks into sys.path, so
if use an absolute path
it cannot work.
I found this thread and it seems they are right:
Terry Reedy wrote:
placid [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
.)
When you hibernate/boot up/hibernate for a long time without a clean
reboot, Windows becomes unstable...
This seems to depend on the system. I have gone at least a week, maybe
two, with nightly
Paul Rubin wrote:
John Salerno [EMAIL PROTECTED] writes:
Any reason you can't just read the whole file at once and update m?
Yes, you could say
print md5.new(file('foo.exe').read()).hexdigest()
but that means reading the whole file into memory at once. If the
file is very large,
I might be missing something obvious here, but I decided to experiment
with writing a program that involves a class, so I'm somewhat new to
this in Python.
Anyway, what is the best way to create a function (A) within a class
that another function (B) can use? Function A is not something that
On Sun, 07 May 2006 16:21:01 -0700, [EMAIL PROTECTED] wrote:
So, if this is right, I need to put the .py file to be imported inside
sys.path!! And the relative path will be usedto find the module.
Can I __import__ providing the absolute path?
import sys
print sys.path
['',
Michele Petrazzo wrote:
Then I execute my test. The memory usage of 2.5a2 and gcc 3.3 that I
see with top, is the same (about VIRT: 260 MB and RES: 250MB ) that
with the py 2.3 and 2.4, but then I recompile with 4.1 and execute
the same test, my system stop to work... with top I can see that
It sounds like all you want is some encapsulation, the following makes
methods __head__ and __body__ private - the double underscores are
important. I'd suggest reading the Object bits of the python tutorial
also.
class HTMLWrapper:
def generate(self, ...):
...
self.__head__(foo)
On Sun, May 07, 2006 at 11:57:55AM -0700, Alex Martelli wrote:
[1] I'm considering introducing bugs or misdesigns that have to be
fixed
as part of training for the purposes of this discussion. Also the
Actually, doing it _deliberately_ (on training projects for new people
just coming
You do *NOT* want to put double-underscores before and after a method
name. That does not indicate a private method, it indicates a magic
method -- something that has special meaning to Python. Thus, you
have special methods like __init__(), __len__(), __getattr__(),
__setattr__(), etc; all of
Hi
what does the i a in this code mean. because the code below is
giving False for all the iteration. isn't suppose to evaluate each
value of i to the whole list? thanks
a = range(8)
i = 0
while i 11:
print i a
i = i + 1
False
False
False
False
False
False
False
False
False
False
Robert Kern [EMAIL PROTECTED] writes:
Gary Wessle wrote:
Hi
is the Numerical Python tutorial maintained?
http://www.pfdubois.com/numpy/html2/numpy.html
seams to have some errors and no email to mail them to when found.
No, it is not since Numeric itself is no longer maintained. The
But not matter where eggs are installed they
are never spread across multiple places
on hard drive right? An egg is all under
one node of tree right?
--
http://mail.python.org/mailman/listinfo/python-list
Hi Folks,
I'm thinking about writing a script that can be run over a whole site
and produce a report about broken links etc...
I've been playing with the urllib2 and httplib modules as a starting
point and have found that with urllib2 it doesn't seem possible to get
HTTP status codes.
I've had
You do *NOT* want to put double-underscores before and after a method
name. That does not indicate a private method, it indicates a magic
method
WHOOPS!!
Sorry, I haven't touched python for a few months and just started
working on a script this morning so was going to post my own question
In article [EMAIL PROTECTED],
Gary Wessle [EMAIL PROTECTED] wrote:
Hi
what does the i a in this code mean. because the code below is
giving False for all the iteration. isn't suppose to evaluate each
value of i to the whole list? thanks
a = range(8)
i = 0
while i 11:
print i a
[EMAIL PROTECTED] wrote:
Even if you don't end up referring to self or any instance
attributes within the method, it's simpler to keep it as a normal
method.
Thanks, that makes sense to me! So basically just create them as
methods, and if I want a little 'privacy' I can lead with an
I have tried repeatedly to make a post to the Image SIG ML, and get nothing but automated responses that I must wait for word from the moderator to approve my posting on the list. I have gotten no reply, positive or not, in over a month. I am assuming the Image SIG moderator is currently MIA. What
[EMAIL PROTECTED] wrote:
Even if you don't end up referring to self or any instance
attributes within the method
Hmm, follow-up: I *do* plan to refer to instance attributes inside these
methods (self.something), but does that require that they be instance
methods, or can they still reference
John Salerno wrote:
[EMAIL PROTECTED] wrote:
Even if you don't end up referring to self or any instance
attributes within the method
Hmm, follow-up: I *do* plan to refer to instance attributes inside these
methods (self.something), but does that require that they be instance
methods,
On 8/05/2006 12:45 PM, Gary Wessle wrote:
what does the i a in this code mean. because the code below is
giving False for all the iteration. isn't suppose to evaluate each
value of i to the whole list? thanks
But that's EXACTLY what it's doing; each integer value named i is
notionally being
Calvin Spealman wrote:
I have tried repeatedly to make a post to the Image SIG ML, and get
nothing but automated responses that I must wait for word from the
moderator to approve my posting on the list. I have gotten no reply,
positive or not, in over a month. I am assuming the Image SIG
Dear all,
In a shell script, I can run a command which need interactive input like
this,
#!/bin/sh
A_Command-EOF
a
b
c
EOF
But, how can I do this with python ?
Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
Alex Martelli wrote:
Steve R. Hastings [EMAIL PROTECTED] wrote:
...
But the key in the whole thread is simply that indentation will not
scale. Nor will Python.
This is a curious statement, given that Python is famous for scaling well.
I think ridiculous is a
John Salerno wrote:
Ugh, sorry about another post, but let me clarify: In these utility
functions, I need to refer to an attribute of an instance, but these
functions will be called from another method in the class, not from the
instance itself. Is this even possible, or would 'self' have no
[EMAIL PROTECTED] wrote:
I'm having trouble deciphering what this bit means - but these
functions will be called from another method in the class, not from the
instance itself, I don't think it makes sense.
Yeah, I'm starting to see that as I tried to implement it. Here's what I
came up
My initial feeling is that concatenation might take longer than
substitution, but that it is also easier to read:
def p(self, paragraph):
self.source += 'p' + paragraph + '/p\n\n'
vs.
def p(self, paragraph):
self.source += 'p%s/p\n\n' % paragraph
Is there a preference between
John Salerno wrote:
What I originally meant was that they would not be called from an
instance *outside* the class itself, i.e. they won't be used when
writing another script, they are only used by the class itself.
Yep, so you want to encapsulate the functionality that those methods
provide,
I want to create a simple script that dials my modem to whatever number I
specify.
Any tips on modules to be used? google didn't help much this time.
Platform: SuSE 10.1 Linux 2.6.x (but since it will be done in Python, I'm
assuming it doesn't matter what platform I'm using right?)
thanks in
John Salerno wrote:
My initial feeling is that concatenation might take longer than
substitution
Doesn't look that way:
[EMAIL PROTECTED]:~$ python -m timeit 'p%s/p\n\n' % 'foobar'
100 loops, best of 3: 0.6 usec per loop
[EMAIL PROTECTED]:~$ python -m timeit 'p' + 'foobar' + '/p\n\n'
I V wrote:
Monads are one of those parts of functional programming I've never really
got my head around, but as I understand them, they're a way of
transforming what looks like a sequence of imperative programming
statements that operate on a global state into a sequence of function
calls
Alexander Schmolck wrote:
[trimmed groups]
Ken Tilton [EMAIL PROTECTED] writes:
yes, but do not feel bad, everyone gets confused by the /analogy/ to
spreadsheets into thinking Cells /is/ a spreadsheet. In fact, for a brief
period I swore off the analogy because it was so invariably
mystilleef wrote:
Hello,
I need to design a plug-in system for a project. The goal is
to allow third party developers interact with an application
via plug-ins in a clean and robust manner. At this point I
am overwhelmed by my inexperience with designing plug-in
systems.
One of these
[EMAIL PROTECTED] wrote:
Thank you. Yes, that post answers most of the questions. I now have a
bit of an understanding of the \xhh pattern. It's still unclear to me,
however, how one can go from the \x92 pattern and arrive at the
apostrophe character. Is \x92 theh apostrophe character in
Chris Lambacher [EMAIL PROTECTED] wrote:
On Sun, May 07, 2006 at 11:57:55AM -0700, Alex Martelli wrote:
[1] I'm considering introducing bugs or misdesigns that have to be
fixed
as part of training for the purposes of this discussion. Also the
Actually, doing it _deliberately_
Alex Martelli wrote:
Worst case, you name all your functions Beverly so you don't have to
think about the naming
I didn't think about this, probably because I am accustomed to Haskell,
where you rather give functions different names (at the module top-level
you have no other choice). I just
niether .join() is the fastest
--
http://mail.python.org/mailman/listinfo/python-list
Hi
I have a file with data like
location pressure temp
str flootfloot
I need to read pressure and temp in 2 different variables so that I
can plot them as lines. is there a package which reads from file with
a given formate and returns desired variables? or I need to open,
while not
Bugs item #595601, was opened at 2002-08-15 11:34
Message generated for change (Comment added) made by aegis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=595601group_id=5470
Please note that this message will contain a full copy of the comment thread,
Bugs item #1471427, was opened at 2006-04-16 22:34
Message generated for change (Comment added) made by alexanderweb
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1471427group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1481770, was opened at 2006-05-04 05:43
Message generated for change (Comment added) made by deckrider
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1481770group_id=5470
Please note that this message will contain a full copy of the comment
Feature Requests item #1110010, was opened at 2005-01-26 11:28
Message generated for change (Comment added) made by gregsmith
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=355470aid=1110010group_id=5470
Please note that this message will contain a full copy of the
Bugs item #1483384, was opened at 2006-05-07 11:41
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1483384group_id=5470
Please note that this message will contain a full copy of
Feature Requests item #1483384, was opened at 2006-05-07 15:41
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=355470aid=1483384group_id=5470
Please note that this message will contain a full copy of the
Feature Requests item #1483384, was opened at 2006-05-07 10:41
Message generated for change (Comment added) made by rhettinger
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=355470aid=1483384group_id=5470
Please note that this message will contain a full copy of
101 - 145 of 145 matches
Mail list logo