On 23/12/15 05:29, Random832 wrote:
>
> This is surprising to anyone accustomed to the POSIX C remove
> function, which can remove either files or directories. Is there
> any known rationale for this decision?
>
Hello, in POSIX C the remove() function is actually rmdir() when called
on a
On Tue, Dec 22, 2015 at 10:29 PM, Random832 wrote:
>
> This is surprising to anyone accustomed to the POSIX C remove
> function, which can remove either files or directories. Is there
> any known rationale for this decision?
Guido added os.remove as a synonym for
This is surprising to anyone accustomed to the POSIX C remove
function, which can remove either files or directories. Is there
any known rationale for this decision?
--
https://mail.python.org/mailman/listinfo/python-list
Random832 writes:
> This is surprising to anyone accustomed to the POSIX C remove
> function, which can remove either files or directories. Is there
> any known rationale for this decision?
No, I don't know a rationale for implementing it this way.
I expect the
I still can't get the syntax
test='Hey buddy get away from my car'
if test[0].alpha():
return True
--
https://mail.python.org/mailman/listinfo/python-list
On 9/2/14 4:13 PM, Seymore4Head wrote:
I still can't get the syntax
test='Hey buddy get away from my car'
if test[0].alpha():
return True
A really good skill to learn early on is how to ask for help. You need
to tell us what you expected it to do, and also what it did that
displeased
check, that's
isalpha(), not alpha(), as you can see from the docs.
Suggestion: Choose subject lines that reflect the subject matter being
discussed. Why doesn't this work isn't very helpful. :)
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On 02/09/2014 21:13, Seymore4Head wrote:
I still can't get the syntax
test='Hey buddy get away from my car'
if test[0].alpha():
return True
isalpha?
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
On Tue, Sep 2, 2014 at 3:13 PM, Seymore4Head Seymore4Head@hotmail.invalid
wrote:
I still can't get the syntax
test='Hey buddy get away from my car'
if test[0].alpha():
return True
My guess is you meant isalpha(), as Mark indicated. Here's a cheap way to
see what an object can do:
On Tue, 02 Sep 2014 16:13:39 -0400, Seymore4Head
Seymore4Head@Hotmail.invalid wrote:
I still can't get the syntax
test='Hey buddy get away from my car'
if test[0].alpha():
return True
I have a huge head cold right now. Never mind the question.
Sorry
--
Where is the fault in my reasoning here?
1) According to http://docs.python.org/dev/install/, The most
convenient way is to add a path configuration file to a directory that’s
already on Python’s path, (...).
2) Path configuration files have an extension of .pth, (...)
12 = 3) A file test.pth
On Mon, 18 May 2009 11:49:15 +0200, Philipp Hagemeister phi...@phihag.de
wrote:
1) According to http://docs.python.org/dev/install/, The most
convenient way is to add a path configuration file to a directory
that’s
already on Python’s path, (...).
It's true...
2) Path configuration files
Philipp Hagemeister schrieb:
Where is the fault in my reasoning here?
Python processes .pth files only in some directories. The directories are
* the global site-packages directory
* the user site-packages directory (starting with Python 2.6)
* and any directory that is added by a .pth file
David Lyon wrote:
(...)
12 = 3) A file test.pth with the content /example/ should result in
sys.path containing /example/.
No. Python, once finding the .pth will process it.
Yes, but that processing will add /example/ to sys.path, right?
4) (the current directory) is the first element
On Mon, 18 May 2009 14:34:33 +0200, Philipp Hagemeister phi...@phihag.de
wrote:
Yes, but that processing will add /example/ to sys.path, right?
It actually works the other way around. The directories listed in
sys.path are scanned for .pth files.
You can add packages by listing them inside a
David Lyon wrote:
On Mon, 18 May 2009 14:34:33 +0200, Philipp Hagemeister phi...@phihag.de
wrote:
Yes, but that processing will add /example/ to sys.path, right?
It actually works the other way around. The directories listed in
sys.path are scanned for .pth files.
You can add packages by
David Lyon wrote:
On Mon, 18 May 2009 14:34:33 +0200, Philipp Hagemeister phi...@phihag.de
wrote:
Yes, but that processing will add /example/ to sys.path, right?
It actually works the other way around. The directories listed in
sys.path are scanned for .pth files.
No, they are not. That's
On Mon, 18 May 2009 14:05:50 +0100, Tim Golden m...@timgolden.me.uk
wrote:
According to http://docs.python.org/install/index.html and my
own reasonably long experience of them, they're just a way of
getting extra paths into sys.path.
Well, fair enough...
The docs referred to above do
En Thu, 19 Mar 2009 19:33:36 -0300, Ryan Kelly r...@rfk.id.au escribió:
newCylinderTempertature = newCylinderTemperature + deltaTemp
Take a careful look at the variable name here: Tempertature. Python's
dynamic nature provides a lot of wonderful benefits, but you've just hit
one of
Hi people.
I've got a small piece of code that I don't understand. Basically, a
variable inside an if statement inside a for loop doesn't seem to be
updating. Is this a scope issue ?
Thanks
Code segment:
snip
# run through the cycle and calculate the temperature and pressure at
each
newCylinderTempertature = newCylinderTemperature + deltaTemp
Take a careful look at the variable name here: Tempertature. Python's
dynamic nature provides a lot of wonderful benefits, but you've just hit
one of the drawbacks - you don't get any protection from typos in
variable names.
Linuxguy123 linuxguy123 at gmail.com writes:
Hi people.
I've got a small piece of code that I don't understand. Basically, a
variable inside an if statement inside a for loop doesn't seem to be
updating. Is this a scope issue ?
No, it's because you mispelled the variables.
--
In article mailman.2240.1237501716.11746.python-l...@python.org,
Linuxguy123 linuxguy...@gmail.com wrote:
I've got a small piece of code that I don't understand. Basically, a
variable inside an if statement inside a for loop doesn't seem to be
updating. Is this a scope issue ?
Nope, it's a
I'm trying to build a small Python app in Eclipse under Fedora 10.
I have the following code:
import os
import sys
import pexpect
child = pexpect.spawn('/bin/bash')
child.interact()
When I run it in Eclipse, I get:
Traceback (most recent call last):
File
On Jan 30, 11:03 am, Linuxguy123 linuxguy...@gmail.com wrote:
I'm trying to build a small Python app in Eclipse under Fedora 10.
I have the following code:
import os
import sys
import pexpect
child = pexpect.spawn('/bin/bash')
child.interact()
When I run it in Eclipse, I get:
On Aug 5, 8:34 am, ssecorp [EMAIL PROTECTED] wrote:
I have in Lib/site-packages a module named pdfminer. when I do import
pdfminer it complains:
so I apparently can't import a directory pdfminer. In the directory
pdfminer there are 3 other directoriees and inside them python-files.
Are the 3
ssecorp was kind enough to say:
I have in Lib/site-packages a module named pdfminer. when I do import
pdfminer it complains:
import pdfminer
If you've got a directory, that's not a module - it's a package.
In order to import a directory as a package, you must create a (possibly
empty)
I have in Lib/site-packages a module named pdfminer. when I do import
pdfminer it complains:
import pdfminer
Traceback (most recent call last):
File pyshell#3, line 1, in module
import pdfminer
ImportError: No module named pdfminer
I created a file pdfminer.py and put it in
On Aug 4, 3:34 pm, ssecorp [EMAIL PROTECTED] wrote:
I have in Lib/site-packages a module named pdfminer. when I do import
pdfminer it complains:
import pdfminer
Traceback (most recent call last):
File pyshell#3, line 1, in module
import pdfminer
ImportError: No module named
On Mon, Aug 4, 2008 at 3:34 PM, ssecorp [EMAIL PROTECTED] wrote:
I have in Lib/site-packages a module named pdfminer. when I do import
pdfminer it complains:
import pdfminer
Traceback (most recent call last):
File pyshell#3, line 1, in module
import pdfminer
ImportError: No module
On Mon, Aug 4, 2008 at 6:40 PM, Sean DiZazzo [EMAIL PROTECTED] wrote:
On Aug 4, 3:34 pm, ssecorp [EMAIL PROTECTED] wrote:
I have in Lib/site-packages a module named pdfminer. when I do import
pdfminer it complains:
import pdfminer
Traceback (most recent call last):
File
Hi all,
I am trying to understand new-style classes in Python and I have found
your postings here.
Gabriel, if I understand it properly, it is necessary to define get/
set/del/doc methods for each attribute for which I want to set the
property data descriptor (which triggers get/set/del/doc
En Tue, 01 Jan 2008 16:57:41 -0200, [EMAIL PROTECTED] escribi�:
Gabriel, if I understand it properly, it is necessary to define get/
set/del/doc methods for each attribute for which I want to set the
property data descriptor (which triggers get/set/del/doc function
calls upon access to
My question is: is it possible to set the property for any attribute
when I do not know what will be the name of the attribute in the
future?
Uhm... I don't understand the question. Perhaps if you think of a concrete
case...?
Thanks for reply,
few minutes after i posted my question, I
On Tue, 01 Jan 2008 13:01:24 -0800, petr.jakes.tpc wrote:
My question is: is it possible to set the property for any
attribute when I do not know what will be the name of the attribute
in the future?
Uhm... I don't understand the question. Perhaps if you think of a
concrete case...?
Steven,
thanks for a nice explanation.
I am trying to experiment a little bit with new-style class and I am
confused why following example always returns 0 (zero). I was
expecting generator object will return values from 0 to 9 and finaly
an Exception.
class GenExample(object):
def
En Wed, 02 Jan 2008 01:11:12 -0300, [EMAIL PROTECTED] escribió:
I am trying to experiment a little bit with new-style class and I am
confused why following example always returns 0 (zero). I was
expecting generator object will return values from 0 to 9 and finaly
an Exception.
class
Hi Python Community:
Despite my new-ness to Python I have alreadhy been able to do some (I
think) amazing things. It is a truly elegant and smart language.
Yet, I can not seem to get a handle on something simple.
I would like to make a class which has private varaiables fName and
lName. It
Perhaps you'd be better off using a standard property? Within your Person
class, you can define a property 'name' to handle what you're trying to do:
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type copyright, credits or license() for more
En Mon, 31 Dec 2007 14:56:02 -0200, [EMAIL PROTECTED] escribi�:
Hi Python Community:
Despite my new-ness to Python I have alreadhy been able to do some (I
think) amazing things. It is a truly elegant and smart language.
Yet, I can not seem to get a handle on something simple.
I would
A couple items of note:
class Person:
This should be class Person(object) to take advantage of some
of the features that new-style classes offer...particularly in
this case.
def __init__(self, fName=, lName=):
self.__fName = fName
self.__lName = lName
def
Thanks you Gabriel and Timm for your thoughtful responses. I am very
appreciative.
I had heard about the properties function, but wanted to understand
the old syntax first before I tried that. Thanks to your responses, I
was able to see what the problem was.
Here is a solution I came up with:
I didn't actually answer your question, my apologies!
The reason you're failing is due to your use of the __setattr__ call.
Remember, when you override __setattr__, you need to handle *all* of the
logic behind setting object attributes. You're only attempting to do so
when handling the 'name'
En Mon, 31 Dec 2007 16:01:38 -0200, [EMAIL PROTECTED] escribi�:
Thanks you Gabriel and Timm for your thoughtful responses. I am very
appreciative.
I had heard about the properties function, but wanted to understand
the old syntax first before I tried that. Thanks to your responses, I
was
Python 2.3.5 (#1, Jan 30 2006, 13:30:29)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1819)] on darwin
Type help, copyright, credits or license for more information.
from datetime import datetime
class ts(datetime):
... def __init__(self): pass
...
ts()
Traceback (most recent call last):
Because datetime is a new-style class:
The Constructor __new__
If you are like me, then you probably always thought of the __init__ method as
the Python equivalent of what is called a constructor in C++. This isn't the
whole story.
When an instance of a class is created, Python first calls the
In article [EMAIL PROTECTED],
Larry Bates [EMAIL PROTECTED] wrote:
Because datetime is a new-style class:
Ah.
The Constructor __new__
If you are like me, then you probably always thought of the __init__ method
as
the Python equivalent of what is called a constructor in C++. This isn't
I wrote:
WindowsError: [Errno 3] : 'O:/eb/mb/S/*.*'
shutil.rmtree() expects a directory name, not a file pattern. if you leave
out the *.* part at the end, it should do what you want.
postscript: typically enough, I stumbled upon the same error message myself,
a day later. looks like it's
On Fri, 31 Mar 2006 18:37:11 -0800, obeeker wrote:
there is threee directories,one of these is used for the base
directory,decided by the user, default is d0
[snip code]
It doesn't work? Have you tried running it to see what it does? When you
do, please post a description of what it does,
thank you for your suggestion and apologize for my mistake.
if i run it and answer the raw_input with Enter i get
sth is wrong
press Return
i comment the try-except and run it and answer the raw_input with
Enter
and get message following:
Traceback (most recent call last):
File
please don't read the prevous post ,please read this one:
thank you for your suggestion and apologize for my mistake.
if i run it and answer the raw_input with Enter i get
sth is wrong
press Return
i comment the try-except and run it and answer the raw_input with
Enter
and get message
[EMAIL PROTECTED] wrote:
please don't read the prevous post ,please read this one:
thank you for your suggestion and apologize for my mistake.
if i run it and answer the raw_input with Enter i get
sth is wrong
press Return
i comment the try-except and run it and answer the raw_input with
i am very sorry .
the erroer was from my Portable Hard Disk
because its disk sign has changed from o to h ,from p to i
i'm very sorry
--
http://mail.python.org/mailman/listinfo/python-list
there is threee directories,one of these is used for the base
directory,decided by the user, default is d0
import shutil
#the three directories
d0='D:/Program Files/eb/mb/S'
d1='O:/eb/mb/S'
d2='P:/S/eb/mb/S'
#to backup
def update(base):
l=[d0,d1,d2]
l.remove(base)
for
I have written a simple C++ program in my efforts to learn how to
extend Python. It is shown below. Everything compiles and installs
correctly, but I get strange answers. I know the function Pi is
correct because when I call it from a C++ code it gives the correct
answers. This is what I get
jeremito wrote:
I have written a simple C++ program in my efforts to learn how to
extend Python. It is shown below. Everything compiles and installs
correctly, but I get strange answers. I know the function Pi is
correct because when I call it from a C++ code it gives the correct
answers.
Well what do you know, that worked! It's one of those errors that you
can't see yourself, but someone else can see it instantly.
Thanks,
Jeremy
--
http://mail.python.org/mailman/listinfo/python-list
Jumping right into the code (which should speak for itself):
# ---
try:
# this will fail and be caught
# below, w
import foobar
except ImportError, error:
class foobar:
@staticmethod
def
I think what you really want is:
try:
# this will fail and be caught
# below, w
import foobar
except ImportError, error:
class foobarclass:
def __getattr__(*args, **kargs):
return None
foobar = foobarclass()
print
On Fri, 2005-10-28 at 14:50 -0400, Chris Lambacher wrote:
I think what you really want is:
try:
# this will fail and be caught
# below, w
import foobar
except ImportError, error:
class foobarclass:
def __getattr__(*args, **kargs):
Jeremy Moles [EMAIL PROTECTED] wrote:
Am I misunderstanding something fundamental about the builtin __*
functions? Can they not be static?
They can and must be static when their specification say they are (e.g.,
__new__) and they cannot and must not be static when their specification
says
Hi,
I'm a bit stuck with this python script. It's aim is to encode all flac files
to wav and then to mp3. The only problem I have is to preserve the tags. The
code works when there's just one flac file in a directory but fails for more.
I can't see why the for loop fails here (flactags).
The
On Tue, 22 Mar 2005 12:10:50 +0100, Bouke Woudstra
[EMAIL PROTECTED] wrote:
Hi,
I'm a bit stuck with this python script. It's aim is to encode all flac files
to wav and then to mp3. The only problem I have is to preserve the tags. The
code works when there's just one flac file in a directory
The error thrown is: UnboundLocalError: local variable 'title' referenced
before assignment
That should be pretty obvious: The UnboundLocalError comes up when you try
to access a variable that hasn't been assigned a value before. E.g try this
in an interactive python session:
foo = hello
Thanks for all suggestions. Your first point I knew, but was too lazy to type
it. It made no difference for the test files had all tags. Knowing that it
was not a asynchrous thing helped me a lot though. There had to be something
wrong with the command line for metaflac.
It turned out that
Bouke Woudstra wrote:
It turned out that some flac files have tags like Artist=artistname and others
have artist=artistname. Therefore it couldn't find the artist! So now I just
look for 'rtist=' which works great.
You might want try using something like this:
wanted = set('artist album date
On Tue, 22 Mar 2005 09:21:49 -0800, Scott David Daniels [EMAIL PROTECTED]
wrote:
Bouke Woudstra wrote:
It turned out that some flac files have tags like Artist=artistname and
others
have artist=artistname. Therefore it couldn't find the artist! So now I just
look for 'rtist=' which works
On Tue, 22 Mar 2005 12:10:50 +0100, Bouke Woudstra
[EMAIL PROTECTED] wrote:
for flac in flacfiles:
cmd = 'metaflac --export-tags=- %s' % flac
for line in os.popen(cmd).readlines():
if 'Artist' in
68 matches
Mail list logo