[OFF] Convert GMap Encoded Polyline string to a set of coordinates

2012-11-17 Thread leonardo
Hi,

How to convert GMap Encoded Polyline string to a set of coordinates ?
I need it to calculate the distance between a coordinate and a line in a Django 
app.

Thanks,
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: request for help

2013-02-18 Thread leonardo

thanks guys and sorry for my incomplete datas, here is the error message:

Traceback (most recent call last):
 File "", line 1, in 
   import circle
 File "circle.py", line 1
   Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
^
SyntaxError: invalid syntax


thanks for any help!






Il giorno 18/feb/2013, alle ore 20:59, Stefan Holdermans 
 ha scritto:

> Leonardi,
> 
>> i saved the above program from python shell into a file as "circle.py" . 
>> when i type "import circle" i get  error..
> 
> 
> Next time, please mention what kind of error you're getting.
> 
> Was it an indentation error? Because, as you pasted it, your code would lead 
> to one.
> 
> If I fix the indentation, as in
> 
> import math
> 
> def area(radius):
>   return math.pi * radius**2
> 
> def circumference(radius):
>   return 2 * math.pi * radius
> 
> it works fine for me.
> 
> HTH,
> 
> Stefan
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


i need help

2013-02-21 Thread leonardo

hi guys,

i just created this file:

print "i love pizza!"
print "pizza" * 20
print "yum" * 40
print "i'm full."

and saved it into a file with "idle-gui", if i try to run the program i 
get an invalid syntax error, it displays a red sign on the  quote mark 
at the end of the first row of my program..

i checked but i didn't make mistaked..is idle a bit crazy??

pls let me know
many thanks!
--
http://mail.python.org/mailman/listinfo/python-list


Re: i need help

2013-02-21 Thread leonardo

thanks, problem solved


Il 21/02/2013 10.13, Chris Angelico ha scritto:

On Thu, Feb 21, 2013 at 8:09 PM, leonardo  wrote:

hi guys,

i just created this file:

print "i love pizza!"
print "pizza" * 20
print "yum" * 40
print "i'm full."

and saved it into a file with "idle-gui", if i try to run the program i get
an invalid syntax error, it displays a red sign on the  quote mark at the
end of the first row of my program..
i checked but i didn't make mistaked..is idle a bit crazy??

Are you using Python version 3? If so, you need to put parentheses
around your print arguments, because print is a function:

print("i love pizza!")
print("pizza" * 20)
print("yum" * 40)
print("i'm full.")

As an additional tip, I believe your keyboard has a couple of keys on
it marked "Shift". Holding one down lets you produce capital letters,
which make your emails significantly more readable. Get some practice
with these keys, as you'll use them a lot in programming :)

ChrisA


--
http://mail.python.org/mailman/listinfo/python-list


nested loops

2013-02-26 Thread leonardo

hi everyone,

i have the following program:

import time
count_timer = int(raw_input('how many seconds?: '))
for i in range(count_timer, 0, -1):
print i
time.sleep(1)
print 'blast off!'


this is the result:

how many seconds?: 5
5
4
3
2
1
blast off!

how can i have it print  a row of stars beside each number, like this?:

how many seconds?: 5
5 * * * * *
4 * * * *
3 * * *
2 * *
1 *
blast off!


--
http://mail.python.org/mailman/listinfo/python-list


Re: nested loops

2013-02-26 Thread leonardo

thanks for the help, it works


Il 26/02/2013 10.58, Sven ha scritto:

Here's one solution

import time
count_timer = int(raw_input('how many seconds?: '))
for i in range(count_timer, 0, -1):
||print i,
print "*" * i
time.sleep(1)
print 'blast off!'


On 25 February 2013 22:46, leonardo <mailto:tampucciol...@libero.it>> wrote:


hi everyone,

i have the following program:

import time
count_timer = int(raw_input('how many seconds?: '))
for i in range(count_timer, 0, -1):
print i
time.sleep(1)
print 'blast off!'


this is the result:

how many seconds?: 5
5
4
3
2
1
blast off!

how can i have it print  a row of stars beside each number, like
this?:

how many seconds?: 5
5 * * * * *
4 * * * *
3 * * *
2 * *
1 *
blast off!


-- 
http://mail.python.org/mailman/listinfo/python-list





--
./Sven


-- 
http://mail.python.org/mailman/listinfo/python-list


idle doesn't work

2013-03-10 Thread leonardo

hi guys

i have a mac os x 10.8, i had already python 2.7, i downloaded python 
3.3 and active tcl 8.5, but idle and the new version don't work, the 
answer is:"idle's subprocess didn't make connection or personal firewall 
is blocking". do you know what can i do ?

or can i use other easy editors to program in python?

thanks!
best regards
--
http://mail.python.org/mailman/listinfo/python-list


idle doesn't work

2013-03-10 Thread leonardo

>> hi guys
>> 
>> i have a mac os x 10.8, i had already python 2.7, i downloaded python 
>> 3.3 and active tcl 8.5, but idle and the new version don't work, the 
>> answer is:"idle's subprocess didn't make connection or personal firewall 
>> is blocking". do you know what can i do ?

thanks and regards
> 
> 

-- 
http://mail.python.org/mailman/listinfo/python-list


idle (GUI)doesn't work…

2013-03-10 Thread leonardo
>>> hi guys
>>> i need help:
>>> i have a mac os x 10.8, i had already python 2.7, i downloaded python 
>>> 3.3 and active tcl 8.5, but idle and the new version don't work, the 
>>> answer is:"idle's subprocess didn't make connection or personal firewall 
>>> is blocking" plus in the terminal i still have python 2.7. do you know what 
>>> can i do ?
> 
> thanks and regards
>> 
>> 
> 

-- 
http://mail.python.org/mailman/listinfo/python-list


Fwd: Re: [Python-Help] idle doesn't work

2013-03-11 Thread leonardo






sorry for that, that answer didn't help me..

regards



Il 10/03/2013 23.59, Matthew Dixon Cowles ha scritto:

Dear Leonardo,
Sending the same message three times isn't likely to produce faster
or better help.

Is the reply that you got on the main Python list satisfactory?

Regards,
Matt






--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Help] idle doesn't work

2013-03-12 Thread leonardo


first of all thanks for trying to help me. the text of my email was the 
following:
i have a mac os x 10.8, i had already python 2.7, i downloaded python 
3.3 and active tcl 8.5, but idle and the new version don't work, the 
answer is:"idle's subprocess didn't make connection or personal firewall 
is blocking". do you know what can i do ?

or can i use other easy editors to program in python?

i am frustated cause i can use only the old python 2.7 in the terminal 
window. python 3.3 has not taken place and idle gives the above 
mentioned error..


thanks for any help!





Il 12/03/2013 0.20, Matthew Dixon Cowles ha scritto:

Dear Leonardo,
I only got two copies of that message. We're going in the right
direction.


that answer didn't help me..

Did it not work to run IDLE in a terminal window with the "-n"
argument? Or are you having difficulty doing that?

IDLE doesn't have any unique abilities. Many people (including me)
use Python under OS X with just a couple of terminal windows and a
text editor. Have you tried that? Have you run into difficulties with
it?

Regards,
Matt




--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Help] idle doesn't work

2013-03-12 Thread leonardo


thanks now python shell works



Il 12/03/2013 17.52, Ned Deily ha scritto:

In article <513f5080.6030...@libero.it>,
  leonardo  wrote:

first of all thanks for trying to help me. the text of my email was the
following:
i have a mac os x 10.8, i had already python 2.7, i downloaded python
3.3 and active tcl 8.5, but idle and the new version don't work, the
answer is:"idle's subprocess didn't make connection or personal firewall
is blocking". do you know what can i do ?
or can i use other easy editors to program in python?

i am frustated cause i can use only the old python 2.7 in the terminal
window. python 3.3 has not taken place and idle gives the above
mentioned error..

Try typing the following in a terminal window:

  idle3.3

or, possibly

  /usr/local/bin/idle3.3

and see if there is a more useful error message.

If that doesn't work, try adding -n:

  idle3.3 -n



--
http://mail.python.org/mailman/listinfo/python-list


programming course

2013-03-12 Thread leonardo

sorry for bothering you, i found www.code.org, do you think is that useful? i 
am a beginner and i would really like to learn, but i need a step by step 
website or books, any recommendations?

thanks!



Inizio messaggio inoltrato:

> Da: Ned Deily 
> Oggetto: Re: [Python-Help] idle doesn't work
> Data: 12 marzo 2013 17:52:12 CET
> A: python-list@python.org
> 
> In article <513f5080.6030...@libero.it>,
> leonardo  wrote:
>> first of all thanks for trying to help me. the text of my email was the 
>> following:
>> i have a mac os x 10.8, i had already python 2.7, i downloaded python 
>> 3.3 and active tcl 8.5, but idle and the new version don't work, the 
>> answer is:"idle's subprocess didn't make connection or personal firewall 
>> is blocking". do you know what can i do ?
>> or can i use other easy editors to program in python?
>> 
>> i am frustated cause i can use only the old python 2.7 in the terminal 
>> window. python 3.3 has not taken place and idle gives the above 
>> mentioned error..
> 
> Try typing the following in a terminal window:
> 
> idle3.3
> 
> or, possibly
> 
> /usr/local/bin/idle3.3
> 
> and see if there is a more useful error message.
> 
> If that doesn't work, try adding -n:
> 
> idle3.3 -n
> 
> -- 
> Ned Deily,
> n...@acm.org
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problem with function

2013-03-22 Thread leonardo

thank you all



Il giorno 22/mar/2013, alle ore 00:20, Terry Reedy  ha 
scritto:

> On 3/21/2013 2:31 PM, leonardo selmi wrote:
> 
>> i wrote the following code:
>> 
>> def find(word, letter):
>> index = 0
>> while index < len(word):
>> if word[index] == letter:
>> return index
>> index = index + 1
>> return -1
> 
> Since this is a learning exercise, consider the following.
> 
> def find(word, letter):
>for index, let in enumerate(word):
>if let  == letter:
>return index
>return -1
> 
> for w, l, n in (('abc', 'a', 0), ('abc', 'c', 2), ('abc', 'd', -1)):
>assert find(w, l)  == n
> print("no news is good news")
> 
> I copied the code, wrote the test, ran it, and it passed. I then re-wrote 
> until syntax errors were gone and the new version passed. For loops are 
> specialized, easier-to-write version of while loops that scan the items of a 
> collection (iterable). Learn them and use them well. Learn to write automated 
> tests as soon as possible.
> 
> -- 
> Terry Jan Reedy
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how does the % work?

2013-03-23 Thread leonardo

thank you all!


Il 23/03/2013 8.38, Steven D'Aprano ha scritto:

On Fri, 22 Mar 2013 21:29:48 -0700, Tim Roberts wrote:


leonardo selmi  wrote:

i wrote this example :

name = raw_input("What is your name?")
quest = raw_input("What is your quest?")
color = raw_input("What is your favorite color?")

print """Ah, so your name is %s, your quest is %s, and your favorite
color is %s."""  % (name, quest, color)

No, you didn't.  You wrote:

print('''Ah, so your name is %s, your quest is %s, and your
 favorite color is %s.''') % (name, quest, color)


The difference between those two statements may not be entirely clear to
someone not experienced in reading code carefully.

Consider the difference between:

   print(a % b)

   print(a) % b

In the first example, the round brackets group the "a % b", which is
calculated first, then printed.

In the second example, in Python 3, the "print(a)" is called first, which
returns None, and then "None % b" is calculated, which raises an
exception.

Just to add confusion, the two lines are exactly the same in Python 2,
where Print is not a function!



You are using Python 3.  In Python 3, "print" is a function that returns
None.  So, the error is exactly correct.  To fix it, you need to have
the % operator operate on the string, not on the result of the "print"
function:

print('''Ah, so your name is %s, your quest is %s, and your
 favorite color is %s.''' % (name, quest, color))

Exactly correct.





--
http://mail.python.org/mailman/listinfo/python-list


Re: help needed

2013-04-08 Thread leonardo

thanks barrett, but i am using a mac..



Il 08/04/2013 11.15, Barrett Lewis ha scritto:
Do you happen to be on windows? Because if you are then you need to 
edit the registry. If you are on windows let me know and I will walk 
you through the fix, but if not then it would be a waste of time for 
me to explain it.





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help needed

2013-04-08 Thread leonardo

thanks adam, but it is not clear to me yet.
if i open the terminal how do i work on it? what should i type in?

thanks


Il giorno 08/apr/2013, alle ore 11:25, Adam Mesha  ha scritto:

> On Mon, Apr 8, 2013 at 11:01 AM, leonardo selmi  wrote:
> then i get this error:
> 
> Traceback (most recent call last):
>   File "/Users/leonardo/Documents/ex13.py", line 3, in 
> script, first, second, third = argv
> ValueError: need more than 1 value to unpack
> 
> You didn't provide any arguments to the script.
>  
> in the book the author says that i should run the program like this:
> 
> $ python ex13.py first 2nd 3rd
> The script is called: ex13.py
> Your first variable is: first
> Your second variable is: 2nd
> Your third variable is: 3rd
> but how can i do that?? what are the steps? where should i go?
> 
> You need to open a command line terminal and type the first line (without the 
> dollar sign). You will need to change your directory to the directory that 
> contains your exercise script, probably by doing "cd 
> /path/to/exercise/directory". If you're on Windows it's the same idea, you 
> run the "cmd" program, but you would have to specify the full path to the 
> python interpreter instead of just "python", or follow the directions that 
> have been offered for fixing Windows.
> 
> Adam
> www.mesha.org
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help needed

2013-04-09 Thread leonardo
thanks i did it!



Il giorno 08/apr/2013, alle ore 13:56, rusi  ha scritto:

> On Apr 8, 4:41 pm, Dave Angel  wrote:
> 
>> Go back to the previous message and you'll see Adam tells you exactly
>> what to type at the terminal.  But to be more literal:
>> 
>> python ex13.py  first 2nd 3rd
> 
> 
> followed by RET (also called ENTER) key
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help..

2013-05-02 Thread leonardo
on codecademy there is an interactive box where you type your code, it is a 
kind of exercise program to practice. but i don't understand what is wrong. 
this is the website address of that if you want to give a look:

http://www.codecademy.com/courses/python-beginner-P5YtY/1/3?curriculum_id=4f89dab3d78889000396




Il giorno 02/mag/2013, alle ore 16:06, Chris Angelico  ha 
scritto:

> On Thu, May 2, 2013 at 11:56 PM, leonardo selmi  wrote:
>> so i wrote the following code:
>> def rental_car_cost(days):
>>cost = 40*days
>>if days >= 7:
>>return cost - 50
>>elif days >= 3 and days < 7:
>>return cost - 20
>>else:
>>return cost
>> 
>> but it seems not to be right cause the computer answers: Oops, try again!
>> Did you create a function called rental_car_cost?
> 
> That code looks fine to me (though I'd drop the "and days < 7" as it's
> redundant); but the error you're getting isn't a Python exception.
> What's giving that error? You may need to check the framing of your
> code. How does codecademy (which I'm not familiar with) locate your
> function?
> 
> ChrisA
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help..

2013-05-02 Thread leonardo
thanks@all


Il giorno 02/mag/2013, alle ore 16:30, Robert Kern  ha 
scritto:

> On 2013-05-02 15:20, leonardo wrote:
>> on codecademy there is an interactive box where you type your code, it is a 
>> kind of exercise program to practice. but i don't understand what is wrong. 
>> this is the website address of that if you want to give a look:
>> 
>> http://www.codecademy.com/courses/python-beginner-P5YtY/1/3?curriculum_id=4f89dab3d78889000396
> 
> I think the problem is in the codecademy interface (or your use of it) rather 
> than the Python code. You will probably get better help in the codecademy 
> forums or help documentation:
> 
>  http://www.codecademy.com/forums/python-beginner-P5YtY/1
>  http://help.codecademy.com/
> 
> -- 
> Robert Kern
> 
> "I have come to believe that the whole world is an enigma, a harmless enigma
> that is made terrible by our own mad attempt to interpret it as though it had
> an underlying truth."
>  -- Umberto Eco
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


if statement on lenght of a list

2011-05-17 Thread Joe Leonardo
Hey all,

Totally baffled by this...maybe I need a nap. Writing a small function to 
reject input that is not a list of 19 fields.

def breakLine(value):
if value.__class__() != [] and value.__len__() != 19:
print 'You must pass a list that contains 19 fields.'
else:
print 'YAY!'

If I pass:
breakLine([])

I get:
YAY!

I expect:
You must pass a list that contains 19 fields.

If I print len(value) I get: 0

What is going on here?

Thanks!




[cid:image001.png@01CC148A.3C0C1950]

Joe Leonardo | Business Intelligence Analyst | 
DataLogix<http://www.datalogix.com>
303.327.1730 d | 415.812.5244 c | 
joe.leona...@datalogix.com<mailto:joe.leona...@datalogix.com>

Better Marketing through Data(tm)


<>-- 
http://mail.python.org/mailman/listinfo/python-list


I wrote a free book about TDD and clean architecture in Python

2019-03-18 Thread giordani . leonardo
Hi all,

I published on Leanpub a free book, "Clean Architectures in Python". It's a 
humble attempt to organise and expand some posts I published on my blog in the 
last years.

You can find it here: https://leanpub.com/clean-architectures-in-python

The main content is divided in two parts, this is a brief overview of the table 
of contents

* Part 1 - Tools
- Chapter 1 - Introduction to TDD
- Chapter 2 - On unit testing
- Chapter 3 - Mocks

* Part 2 - The clean architecture
- Chapter 1 - Components of a clean architecture
- Chapter 2 - A basic example
- Chapter 3 - Error management
- Chapter 4 - Database repositories

Some highlights:

- The book is written with beginners in mind

- It contains 3 full projects, two small ones to introduce TDD and mocks, a 
bigger one to describe the clean architecture approach

- Each project is explained step-by-step, and each step is linked to a tag in a 
companion repository on GitHub

The book is free, but if you want to contribute I will definitely appreciate 
the help. My target is to encourage the discussion about software 
architectures, both in the Python community and outside it.

As of today the book has been downloaded by 7,500 readers. I hope you will 
enjoy the book! if you do, please spread the news on your favourite social 
network
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I wrote a free book about TDD and clean architecture in Python

2019-03-19 Thread Leonardo Giordani
Ha ha ha, yes I get it! =) I'm sorry, that depends entirely on the LeanPub 
processing chain (I believe, I'll have a look just to be sure). I hope the book 
will be useful even with this little issue. Thanks for reading it!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I wrote a free book about TDD and clean architecture in Python

2019-03-21 Thread Leonardo Giordani
Akkana, yes that is a good idea, even though I expected the LeanPub output to 
be already the correct one. I'll check with them.

Thanks for reading the book, you actually gave me an idea: writing something 
about adding tests to a project *after* the code has been written. I already 
wrote a post on it, with a practical example, and this might be interesting. 
Many people discover TDD after they already wrote some code.

Thanks


On Thursday, 21 March 2019 01:15:40 UTC, Akkana Peck  wrote:
> > On 20/03/19 7:18 AM, Leonardo Giordani wrote:
> > > Ha ha ha, yes I get it! =) I'm sorry, that depends entirely on the 
> > > LeanPub processing chain (I believe, I'll have a look just to be sure). I 
> > > hope the book will be useful even with this little issue. Thanks for 
> > > reading it!
> 
> DL Neil writes:
> > Yes, I'm happy reading from cover-to-cover. Unfortunately, not being able to
> > refer back to (say) the Mocks chapter, means it will be of little utility
> > (to me) in-future. 
> 
> For what it's worth, the epub version has chapter links that work
> fine. So maybe you could download the epub version, and use calibre's
> ebook-convert to make a mobi version?
> 
> Nice book, Leonardo. I haven't finished part 2 yet, but part 1
> inspired me to go write some new tests for some of my existing programs,
> and I'm planning to try test-first development for my next project.
> 
> ...Akkana

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I wrote a free book about TDD and clean architecture in Python

2019-03-21 Thread Leonardo Giordani
A couple of people asked the link to the post I mentioned, sorry I forgot to 
add it

http://www.thedigitalcatonline.com/blog/2017/07/21/refactoring-with-test-in-python-a-practical-example/

This is just a very simple exercise in refactoring, but I believe it's a good 
starting point for people who never faced such a task. Enjoy!


On Thursday, 21 March 2019 11:17:11 UTC, Leonardo Giordani  wrote:
> Akkana, yes that is a good idea, even though I expected the LeanPub output to 
> be already the correct one. I'll check with them.
> 
> Thanks for reading the book, you actually gave me an idea: writing something 
> about adding tests to a project *after* the code has been written. I already 
> wrote a post on it, with a practical example, and this might be interesting. 
> Many people discover TDD after they already wrote some code.
> 
> Thanks
> 
> 
> On Thursday, 21 March 2019 01:15:40 UTC, Akkana Peck  wrote:
> > > On 20/03/19 7:18 AM, Leonardo Giordani wrote:
> > > > Ha ha ha, yes I get it! =) I'm sorry, that depends entirely on the 
> > > > LeanPub processing chain (I believe, I'll have a look just to be sure). 
> > > > I hope the book will be useful even with this little issue. Thanks for 
> > > > reading it!
> > 
> > DL Neil writes:
> > > Yes, I'm happy reading from cover-to-cover. Unfortunately, not being able 
> > > to
> > > refer back to (say) the Mocks chapter, means it will be of little utility
> > > (to me) in-future. 
> > 
> > For what it's worth, the epub version has chapter links that work
> > fine. So maybe you could download the epub version, and use calibre's
> > ebook-convert to make a mobi version?
> > 
> > Nice book, Leonardo. I haven't finished part 2 yet, but part 1
> > inspired me to go write some new tests for some of my existing programs,
> > and I'm planning to try test-first development for my next project.
> > 
> > ...Akkana

-- 
https://mail.python.org/mailman/listinfo/python-list


New to Python. For in loops curiosity

2014-05-13 Thread Leonardo Petry
Hi All,

So I am starting with python and I have been working on some simple exercises.

Here is something I found curious about python loops

This loop run each character in a string

def avoids(word,letters):
flag = True
for letter in letters:
if(letter in word):
flag = False
return flag

The loop below (at the bottom) runs each line of the file

fin = open('wordplay.txt');
user_input = raw_input('Enter some characters: ')
count = 0
for line in fin:
word = line.strip()
if(avoids(word, user_input)):
count += 1;

This is just too convenient. 
Basically my question is: Why is python not treating the contents of 
wordplay.txt as one long string and looping each character?

Any comment is greatly appreciate. Thanks


-- 
https://mail.python.org/mailman/listinfo/python-list


PyPI, reStructuredText and readthedocs problems

2015-03-02 Thread Leonardo Giordani
Hi all,

Some time ago I open sourced a package named postage (
https://pypi.python.org/pypi/postage/).

I am experiencing issues with documentation. The project is hosted on
GitHub (https://github.com/lgiordani/postage), where the README.md is
perfectly rendered. My issues are:

1. I use pandoc to convert README.md to README.rst. This latter is rendered
by GitHUb as well, but when I upload the package to PyPI I get a messy
result (look at the package page).

2. When I import the project into readthedocs.org the build fails with no
output. This is the only information I get

- 8< -

Build for postage

Built: Feb. 27, 2015. 10:41 a.m.

State: Finished

Outcome: Failed (Status Code: 0)

Version: latest

Type: html

Build Standard Output

- 8< -

May someone help me figuring out what's wrong in my code?
Thanks!

Leo


Leonardo Giordani
@tw_lgiordani <http://twitter.com/tw_lgiordani> - lgiordani.com
My profile on About.me <http://about.me/leonardo.giordani> - My GitHub page
<https://github.com/lgiordani>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyPI, reStructuredText and readthedocs problems

2015-03-02 Thread Leonardo Giordani
Sorry, seems that GMail cannot understand I'm on a ML, and just answered
the single persons.

[Thread with INADA]
Thank you.

Seems that rst2html.py uses the header of a section as the id of the
corresponding HTML anchor.
Since I had two headers with the same title there was a name clash.
I just changed one of the headers and the problem is gone.


[Thread with Wolfgang]
On 03/02/2015 12:11 PM, Leonardo Giordani wrote:

> Thanks, spotted!
>
> Now readthedocs fails with this message
>
> Traceback (most recent call last):
>File "/home/docs/checkouts/
> readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/cmdline.py
> <
> http://readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/cmdline.py>",
> line 253, in main
>  warningiserror, tags, verbosity, parallel)
>File "/home/docs/checkouts/
> readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/application.py
> <
> http://readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/application.py>",
> line 107, in __init__
>  confoverrides or {}, self.tags)
>File "/home/docs/checkouts/
> readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/config.py
> <
> http://readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/config.py>",
> line 229, in __init__
>  execfile_(filename, config)
>File "/home/docs/checkouts/
> readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/util/pycompat.py
> <
> http://readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/util/pycompat.py>",
> line 105, in execfile_
>  exec code in _globals
>File "conf.py", line 31, in 
>  import postage
>File "/home/docs/checkouts/
> readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/__init__.py
> <
> http://readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/__init__.py>",
> line 10, in 
>  from postage import messaging
>File "/home/docs/checkouts/
> readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/messaging.py
> <
> http://readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/messaging.py>",
> line 4, in 
>  import pika
> ImportError: No module named pika
>
> Exception occurred:
>File "/home/docs/checkouts/
> readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/messaging.py
> <
> http://readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/messaging.py>",
> line 4, in 
>  import pika
> ImportError: No module named pika
> The full traceback has been saved in /tmp/sphinx-err-R4ZC2D.log, if you
> want to report the issue to the developers.
> Please also report this if it was a user error, so that a better error
> message can be provided next time.
> A bug report can be filed in the tracker at <
> https://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
>
> I however configured the build to use a virtualenv and specified 'pika' in
> my requirements.txt file.
>
>
Look at the complete output from readthedocs:

Setup Output



checkout
-



venv
-

Using real prefix '/usr'
New python executable in /home/docs/checkouts/
readthedocs.org/user_builds/postage/envs/latest/bin/python
Installing setuptools, pip...done.
Running virtualenv with interpreter /home/docs/bin/python


doc_builder
-

Requirement already up-to-date: sphinx==1.2.2 in
/var/build/user_builds/postage/envs/latest/lib/python2.7/site-packages
Requirement already up-to-date: virtualenv==1.10.1 in
/var/build/user_builds/postage/envs/latest/lib/python2.7/site-packages
Requirement already up-to-date: setuptools==1.1 in
/var/build/user_builds/postage/envs/latest/lib/python2.7/site-packages
Requirement already up-to-date: docutils==0.11 in
/var/build/user_builds/postage/envs/latest/lib/python2.7/site-packages
Requirement already up-to-date: mkdocs==0.11.1 in
/var/build/user_builds/postage/envs/latest/lib/python2.7/site-packages
Requirement already up-to-date: mock==1.0.1 in
/var/build/user_builds/postage/envs/latest/lib/python2.7/site-packages
Requirement already up-to-date: pillow==2.6.1 in
/var/build/user_builds/postage/envs/latest/lib/python2.7/site-packages
Requirement already up-to-date: readthedocs-sphinx-ext==0.4.4 in
/var/build/user_builds/postage/envs/latest/lib/python2.7/site-packages
Requirement already up-to-date: Jinja2>=2.7.1 in
/var/build/user_builds/postage/envs/latest/lib/python2.7/site-packages
(from mkdocs==

Re: PyPI, reStructuredText and readthedocs problems

2015-03-02 Thread Leonardo Giordani
The libev problem happens on my local Ubuntu 14.10 too. It is not a pike
requirement however (not installed by 'pip install pika').
Seems that pika forces some requirements when on readthedocs through this
code

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
requirements = list()
if on_rtd:
  requirements.append('tornado')
  requirements.append('twisted')
  requirements.append('pyev')

I contacted Gavin Roy, the pika maintainer, to check this with him.

Thanks


Leonardo Giordani
@tw_lgiordani <http://twitter.com/tw_lgiordani> - lgiordani.com
My profile on About.me <http://about.me/leonardo.giordani> - My GitHub page
<https://github.com/lgiordani>

2015-03-02 12:43 GMT+01:00 Leonardo Giordani :

> Sorry, seems that GMail cannot understand I'm on a ML, and just answered
> the single persons.
>
> [Thread with INADA]
> Thank you.
>
> Seems that rst2html.py uses the header of a section as the id of the
> corresponding HTML anchor.
> Since I had two headers with the same title there was a name clash.
> I just changed one of the headers and the problem is gone.
>
>
> [Thread with Wolfgang]
> On 03/02/2015 12:11 PM, Leonardo Giordani wrote:
>
>> Thanks, spotted!
>>
>> Now readthedocs fails with this message
>>
>> Traceback (most recent call last):
>>File "/home/docs/checkouts/
>> readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/cmdline.py
>> <
>> http://readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/cmdline.py>",
>> line 253, in main
>>  warningiserror, tags, verbosity, parallel)
>>File "/home/docs/checkouts/
>> readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/application.py
>> <
>> http://readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/application.py>",
>> line 107, in __init__
>>  confoverrides or {}, self.tags)
>>File "/home/docs/checkouts/
>> readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/config.py
>> <
>> http://readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/config.py>",
>> line 229, in __init__
>>  execfile_(filename, config)
>>File "/home/docs/checkouts/
>> readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/util/pycompat.py
>> <
>> http://readthedocs.org/user_builds/postage/envs/feature-docs/local/lib/python2.7/site-packages/sphinx/util/pycompat.py>",
>> line 105, in execfile_
>>  exec code in _globals
>>File "conf.py", line 31, in 
>>  import postage
>>File "/home/docs/checkouts/
>> readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/__init__.py
>> <
>> http://readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/__init__.py>",
>> line 10, in 
>>  from postage import messaging
>>File "/home/docs/checkouts/
>> readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/messaging.py
>> <
>> http://readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/messaging.py>",
>> line 4, in 
>>  import pika
>> ImportError: No module named pika
>>
>> Exception occurred:
>>File "/home/docs/checkouts/
>> readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/messaging.py
>> <
>> http://readthedocs.org/user_builds/postage/checkouts/feature-docs/postage/messaging.py>",
>> line 4, in 
>>  import pika
>> ImportError: No module named pika
>> The full traceback has been saved in /tmp/sphinx-err-R4ZC2D.log, if you
>> want to report the issue to the developers.
>> Please also report this if it was a user error, so that a better error
>> message can be provided next time.
>> A bug report can be filed in the tracker at <
>> https://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
>>
>> I however configured the build to use a virtualenv and specified 'pika'
>> in my requirements.txt file.
>>
>>
> Look at the complete output from readthedocs:
>
> Setup Output
>
>
>
> checkout
> -
>
>
>
> venv
> -
>
> Using real prefix '/usr'
> New python executable in /home/docs/checkouts/
> readthedocs.org/user_builds/postage/envs/latest/bin/python
> Installing setuptools, pip...done.
&g

Gpg python installer

2015-04-01 Thread leonardo davinci
I am using Kleopatra(gpg for win) to verify the 3.4.3 python installer,
Windows x86 MSI

>https://www.python.org/ftp/python/3.4.3/python-3.4.3.msi>
www.python.org 
/ftp/python/3.4.3/
python-3.4.3.msi
>. This file does
not have a email in the digital signature and I am having trouble verifying
the validity of the download.

Any help would be appreciated.
>thanks
>Leo
-- 
https://mail.python.org/mailman/listinfo/python-list


Short syntax for try/pass

2014-10-14 Thread Leonardo Giordani
Hi all,

a lot of times the following pattern pops out in Python code:

try:
 somecode
except SomeException:
 pass

A very simple example could be if you want to process a list that may be
empty

def process_list(lst):
 try:
  lst[0] = lst[0] + 1
 except IndexError:
  pass

or in more complex cases in which however an exception just signals that
there is nothing to do there.

Converting the code to a non-EAFP version, for example

if len(lst) != 0:
 lst[0] = lst[0] + 1

is in my opinion generally against the Python nature, since it relies on a
specific check on the object, instead of trusting the object as being able
to either satisfy the request or raise an exception. That is, this solution
is non-polymorphic.

In such cases sometimes ABC may help, but generally speaking they it is not
always the case of being an instance of a given ABC or not. The problem
here is if the code raises an exception or not.

Would it be feasible to propose a short syntax like this?

pass SomeException:
  somecode

where the above example would become:

pass IndexError:
 lst[0] = lst[0] + 1

I could not find if such a syntax has been already discussed elsewhere, so
please let me know if this is the case.

Otherwise, what do you think about it?

Thank you

Leonardo



Leonardo Giordani
@tw_lgiordani <http://twitter.com/tw_lgiordani> - lgiordani.com
My profile on About.me <http://about.me/leonardo.giordani> - My GitHub page
<https://github.com/lgiordani>
-- 
https://mail.python.org/mailman/listinfo/python-list


request of information

2013-02-17 Thread leonardo selmi

> 
> 
> 
> 
>> gentlemen:
>> 
>> i am reading a book about python and now i am blocked, i can't store 
>> functions in modules: i have a mac and am using version 2.7.3, i have 
>> created a function and want to save it as a file using "idle", i have saved  
>> it with .py , when i try to import the module i get an error: traceback(most 
>> recent call last) file  
>> "", line 1, in  
>> import circle
>> file "circle.py", line 1
>> syntax error: invalid syntax
>> 
>> can you kindly help me?
>> thanks!
>> 
>> best regards
> 

-- 
http://mail.python.org/mailman/listinfo/python-list


request for help

2013-02-18 Thread leonardo selmi
pls i need help:

i have copied the following from a book and tried to make it work:

import math

def area(radius):
return math.pi * radius**2

def circumference(radius):
return 2 * math.pi * radius

i saved the above program from python shell into a file as "circle.py" . when i 
type "import circle" i get  error..


kind regards
-- 
http://mail.python.org/mailman/listinfo/python-list


need for help

2013-03-01 Thread leonardo selmi
hi guys

i typed the following program:

class ball:
def _init_(self, color, size, direction):
self.color = color
self.size = size
self.direction = direction

def _str_(self):
msg = 'hi, i am a ' + self.size + ' ' + self.color + 'ball!'
return msg

myball = ball('red', 'small', 'down')
print my ball

BUT I GOT THIS ERROR:

Traceback (most recent call last):
  File "/Users/leonardo/Documents/ball2.py", line 11, in 
myball = ball('red', 'small', 'down')
TypeError: this constructor takes no arguments

can you kindly tell me what is wrong?
thanks a lot!
-- 
http://mail.python.org/mailman/listinfo/python-list


book advice

2013-03-01 Thread leonardo selmi
hi

is there anyone can suggest me a good book to learn python? i read many but 
there is always something unclear or examples which give me errors.
how can I start building a sound educational background

thanks for any help 

best regards
-- 
http://mail.python.org/mailman/listinfo/python-list


problem with function

2013-03-21 Thread leonardo selmi
hi all,

i wrote the following code:

def find(word, letter):
index = 0
while index < len(word):
if word[index] == letter:
return index
index = index + 1
return -1

if i run the program i get this error: name 'word' is not defined.  how can i 
solve it?

thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


how does the % work?

2013-03-22 Thread leonardo selmi
hi guys

i wrote this example :

name = raw_input("What is your name?")
quest = raw_input("What is your quest?")
color = raw_input("What is your favorite color?")

print """Ah, so your name is %s, your quest is %s, 
and your favorite color is %s."""  % (name, quest, color)

but i get this error:  Traceback (most recent call last):
  File "/Users/leonardo/print.py", line 5, in 
favourite color is %s.''') % (name, quest, color)
TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

how can i solve it?

thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


i need advice

2013-03-24 Thread leonardo selmi
dear python programmers,

i am focused on learning to program but i need help from all of you. i am a 
beginner but it is hard to find the right book or website to learn, i know that 
i have to do exercises but so far i found resources with gaps. i would be very 
grateful if you could give me suggestions. for example i have "think python" 
and "learning python the hard way", do you recommend them or are there better 
books?

thanks a lot and sorry for bugging you

best regards

leonardo
-- 
http://mail.python.org/mailman/listinfo/python-list


i need advice

2013-03-24 Thread leonardo selmi
dear python programmers,

i am focused on learning to program but i need help from all of you. i am a 
beginner but it is hard to find the right book or website to learn, i know that 
i have to do exercises but so far i found resources with gaps. i would be very 
grateful if you could give me suggestions. for example i have "think python" 
and "learning python the hard way", do you recommend them or are there better 
books?

thanks a lot and sorry for bugging you

best regards

leonardo
-- 
http://mail.python.org/mailman/listinfo/python-list


problem with sys import argv

2013-03-26 Thread leonardo selmi
hi python community,

i wrote the following programm:

from sys import argv

script, userName = argv
prompt = '> '

print 'hi %s, i am the %s script' % (userName, script)
print "i'd like to ask you a few questions."
print 'do you like me %s' % userName
likes = raw_input(prompt)

print "where do you live %s?" % userName
lives = raw_input(prompt)

print 'what kind of computer do you have?'
computer = raw_input(prompt)

print """
alright so you said %r about liking me.
you live in %r. not sure where that is.
and you have a %r computer. nice
""" % (likes, lives, computer)

and i got the following error:  Traceback (most recent call last):
File "/var/folders/89/84z7tw3d3rv39gny3n2p963mgn/T/pythonInTerm.GUF6PWCM", 
line 3, in 
  script, userName = argv
ValueError: need more than 1 value to unpack

what can i do?

thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


help needed

2013-04-08 Thread leonardo selmi
hello all,

i have typed the following program from the book "learn python the hard way":

from sys import argv

script, first, second, third = argv

print "The script is called:", script
print "Your first variable is:", first
print "Your second variable is:", second
print "Your third variable is:", third
then i get this error:

Traceback (most recent call last):
  File "/Users/leonardo/Documents/ex13.py", line 3, in 
script, first, second, third = argv
ValueError: need more than 1 value to unpack

in the book the author says that i should run the program like this:

$ python ex13.py first 2nd 3rd
The script is called: ex13.py
Your first variable is: first
Your second variable is: 2nd
Your third variable is: 3rd
but how can i do that?? what are the steps? where should i go?
thanks!

best regards
leonardo-- 
http://mail.python.org/mailman/listinfo/python-list


help..

2013-05-02 Thread leonardo selmi
i have also this program:

write a function called rental_car_costthat takes days as input and returns the 
cost for renting a car for said number of days. The cost must abide by the 
following conditions:
Every day you rent the car is $40.
If you rent the car for 3 or more days, you get $20 off your total.
If you rent the car for 7 or more days, you get $50 off your total. (This does 
not stack with the 20 dollars you get for renting the car over 3 days.)
so i wrote the following code:
def rental_car_cost(days):
cost = 40*days
if days >= 7:
return cost - 50
elif days >= 3 and days < 7:
return cost - 20
else:
return cost

but it seems not to be right cause the computer answers: Oops, try again! Did 
you create a function called rental_car_cost?

ii wrote also:

def rental_car_cost(days):
if days >= 7:
return (40*days) - 50
if days >= 3 and < 7:
return (40*days) - 20
else:
return (40*days)

they both work in python shell/idle but not in the exercise in 
"codecademy"..what do you think? is there a bug?

thanks!

kindest regards-- 
http://mail.python.org/mailman/listinfo/python-list


help to code...

2013-05-02 Thread leonardo selmi
dear python community,

i wrote the following program:

from datetime import datetime
now = datetime.now()
current_month = now.month
current_day = now.day
current_year = now.year
current_hour = now.hour
current_minute = now.minute
current_second = now.second
print str(current_month) + '/' + str(current_day) + '/' + str(current_year) +' 
'+ 
print str(current_hour) + str(current_minute) + str(current_second)

and i got this error:
Traceback (most recent call last):
  File "runner.py", line 125, in compilecode
  File "python", line 9
print str(current_month) + '/' + str(current_day) + '/' + str(current_year) 
+' '+

 ^
SyntaxError: invalid syntax

how can i write the last two lines correctly?

thanks!


-- 
http://mail.python.org/mailman/listinfo/python-list


learning python

2013-05-05 Thread leonardo selmi
hi guys

i need to find a good book to learn python with exercises and solutions, any 
suggestions?

thanks!

best regards

leonardo-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Help] learning python

2013-05-05 Thread leonardo selmi
thanks!



Il giorno 05/mag/2013, alle ore 18:58, Eric Brunson  ha 
scritto:

> On 05/05/2013 10:08 AM, leonardo selmi wrote:
>> hi guys
>> 
>> i need to find a good book to learn python with exercises and solutions, any 
>> suggestions?
>> 
>> thanks!
>> 
> 
> Leonardo,
> 
> There are several good online tutorials available, many listed here:  
> http://wiki.python.org/moin/BeginnersGuide
> 
> There is also the Python Tutorial written by the creator of Python here:  
> http://docs.python.org/2/tutorial/index.html
> 
> If you want a hands on approach with exercises, try Learn Python the Hard 
> Way:  http://learnpythonthehardway.org/
> 
> If you already have a background in programming I find Dive Into Python to be 
> an excellent introduction:  http://www.diveintopython.net/ as well as Think 
> Python: How to Think Like a Computer Scientist:  
> http://www.greenteapress.com/thinkpython/html/
> 
> If you want something you can hold in your hand and has paper pages, I can 
> recommend Learning Python by Mark Lutz:  
> http://shop.oreilly.com/product/9780596158071.do followed by The Python 
> Cookbook, by Alex Martelli and David Ascher:  
> http://shop.oreilly.com/product/9780596001674.do
> 
> The Massachusetts Institute of Technology uses Python to teach their 
> introduction to programming course which is available online (free) here:  
> http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/index.htm
> 
> I hope that helps.
> 
> Sincerely,
> e.
> 
> 

-- 
http://mail.python.org/mailman/listinfo/python-list


xml.dom.minidom getElementsByTagName white space issue

2009-04-07 Thread Leonardo lozanne
Hi,
 
I'm getting some XML tags with white spaces from a web service and when I try 
to get them with the getElements ByTagName I'm not able to do so. I'm getting 
an empty list. What I'm doing is:
 
#XML_response is an xml string
xml_msg = xml.dom.minidom.parseString(XML_response)
 
nodes = xml_msg.getElementsByTagName("tag ten")  #tag name is "tag ten" with a 
whitespace
 
It all works fine with tags like tag_seven but NOT for tag names with a white 
space. I've tried some escape chars but it doesnt seems to work. 
 
Does anybody has the escape char sequence I should be using or a work around 
for this? Thanks in advanced for your replies. 


  --
http://mail.python.org/mailman/listinfo/python-list


About Python execution speed

2010-04-12 Thread Leonardo Giordani
Hi all,

I'm facing a strange issue in Python execution speed. I'm running the
following test script:

-8<-

dim = 1000
iteration = 10

list1 = []
list2 =  []

for i in range(dim):
list1.append(float(i))
list2.append(float(i) * 0.264)

for k in range(iteration):
for j in range(dim):
ris = 0
ris = ris + list1[j] + list2[j]

-8<-

which runs in about 80 seconds on my local hardware (mean of multiple
execution)
If I move the whole code into a function and call this latter the execution
time drops to about 45 seconds.

What is the reason of this improvement?

Thank you very much in advance.

Leonardo Giordani
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About Python execution speed

2010-04-12 Thread Leonardo Giordani
Thank you Chris and Stefan, this was the answer I was looking for.

Leonardo Giordani
-- 
http://mail.python.org/mailman/listinfo/python-list


How to align the text of a Listbox to the right

2006-04-27 Thread Leonardo da Vinci
Greetings gentlemen and ladies,
I have a question: in Tkinter, how to align a Listbox entry (i.e. a
line of text) to the right?
Google did not show up the answer to my request.
Thanks very much.

L

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to align the text of a Listbox to the right

2006-04-27 Thread Leonardo da Vinci
I have to use a Listbox that shows a list of entries. Every entry is a
char string quite long in size and I cannot set "width" to a large
value due to limitations of screen resolution. The rightmost part is
more important, so I thought that I could show only the end of the
string by aligning the field to the right.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to align the text of a Listbox to the right

2006-04-28 Thread Leonardo da Vinci
Sori Schwimmer ha scritto:

> For a listbox, I would give a width and go with string
> formatting. In your case, I guess that what I'll do is
> to limit the width to something acceptable, and show
> only the tail of the line.

Yes, this is exactly what I wanted to do. Do you know a way to
accomplish that? Because Eric Brunel said it is impossible on a
Listbox.
Thanks to everybody,

L

-- 
http://mail.python.org/mailman/listinfo/python-list


How to detect if file is a directory

2005-04-09 Thread César Leonardo Blum Silveira
Hello all, I'm new to this list.

How can I detect if a file is a directory or not?

Thanks

César
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to detect if file is a directory

2005-04-09 Thread César Leonardo Blum Silveira
Thanks :-)

On Apr 9, 2005 3:55 PM, Tim Jarman <[EMAIL PROTECTED]> wrote:
> César Leonardo Blum Silveira wrote:
> 
> > Hello all, I'm new to this list.
> >
> > How can I detect if a file is a directory or not?
> >
> > Thanks
> >
> > César
> 
> The os module contains many helpful tools for working with files,
> directories, links and so forth. Check out the docs and marvel. The
> following snippet answers your specific question:
> 
> 
> import os.path
> 
> if os.path.isdir("/some/path/here"):
> print "It's a directory!"
> 
> --
> Website: www DOT jarmania FULLSTOP com
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list


Re: A little request about spam

2005-04-14 Thread César Leonardo Blum Silveira
Yeah that is happening to me too! Almost all my python-list e-mails go
to the Spam box.
Maybe we should contact the gmail admins?



On 4/14/05, mark hellewell <[EMAIL PROTECTED]> wrote:
> On 4/14/05, James <[EMAIL PROTECTED]> wrote:
> > Yes - it's been like that for the last month or so now and it's quite
> > annoying, especially seeing as before it was working at near enough
> > 100% accuracy.
> 
> And I don't suppose there's much we can do about it?
> 
> mark
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list