Clay Wiedemann | 11 Mar 20:42
Picon

Re: problems to install python 2.5

Did you download the MacPython 2.5 distribution? You should find an
"Update shell profile.command" file, which you can run. I believe once
you do that, you will be set up so that IDLE will launch and you will
default to version 2.5.

On 3/11/07, Tsila Hassine <tsila.hassine <at> gmail.com> wrote:
> Hello all
>
> I downloaded Python 2.5 (final release) from python.org. I am trying to
> install it on my Mac 0s 10.4
>
> the current working version i have of python is 2.3 (also built as a
> framework)
>
>
> It goes through the "./configure" part ok, but the "make install" produces
> the following errors :
>
>
>
> Modules/posixmodule.c:22: warning: ignoring #pragma weak lchown
> Modules/posixmodule.c:23: warning: ignoring #pragma weak statvfs
> Modules/posixmodule.c:24: warning: ignoring #pragma weak fstatvfs
> Modules/posixmodule.c: In function `posix_lchown':
> Modules/posixmodule.c:1681: warning: implicit declaration of function
> `lchown'
> Modules/posixmodule.c: In function `initposix':
> Modules/posixmodule.c:8588: error: `fstatvfs' undeclared (first use in this
> function)
> Modules/posixmodule.c:8588: error: (Each undeclared identifier is reported
(Continue reading)

Tsila Hassine | 11 Mar 23:01
Picon

Re: problems to install python 2.5

yes I did download that, and it went " sorry can't update zshell" (and yes I have zshell) so i didn't know how to deal with that ....any ideas ? (but then i guess its a completely different problem then ...)

thanks!
T.

On 3/11/07, Clay Wiedemann <clay.wiedemann <at> gmail.com> wrote:
Did you download the MacPython 2.5 distribution? You should find an
"Update shell profile.command" file, which you can run. I believe once
you do that, you will be set up so that IDLE will launch and you will
default to version 2.5.

On 3/11/07, Tsila Hassine <tsila.hassine <at> gmail.com> wrote:
> Hello all
>
> I downloaded Python 2.5 (final release) from python.org. I am trying to
> install it on my Mac 0s 10.4
>
> the current working version i have of python is 2.3 (also built as a
> framework)
>
>
> It goes through the "./configure" part ok, but the "make install" produces
> the following errors :
>
>
>
> Modules/posixmodule.c:22: warning: ignoring #pragma weak lchown
> Modules/posixmodule.c:23: warning: ignoring #pragma weak statvfs
> Modules/posixmodule.c:24: warning: ignoring #pragma weak fstatvfs
> Modules/posixmodule.c: In function `posix_lchown':
> Modules/posixmodule.c:1681: warning: implicit declaration of function
> `lchown'
> Modules/posixmodule.c: In function `initposix':
> Modules/posixmodule.c:8588: error: `fstatvfs' undeclared (first use in this
> function)
> Modules/posixmodule.c:8588: error: (Each undeclared identifier is reported
> only once
> Modules/posixmodule.c:8588: error: for each function it appears in.)
> Modules/posixmodule.c:8596: error: `statvfs' undeclared (first use in this
> function)
> Modules/posixmodule.c:8604: error: `lchown' undeclared (first use in this
> function)
> make: *** [Modules/posixmodule.o] Error 1
>
>
> I can't find any documentation of such a problem on the net, does anyone
> have a clue to what might be the problem ?
>
> thanks!
> Tsila
>
> _______________________________________________
> Tutor maillist  -  Tutor <at> python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>


--

- - - - - - -

Clay S. Wiedemann

voice: 718.362.0375
aim: khlav
wii: 3905 4571 6175 2469
twitter: seastokes

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor
John Fouhy | 11 Mar 23:35
Gravatar

Re: The whole Roman to Dec and vice versa issue

On 12/03/07, Jaggo <jaggojaggo <at> yahoo.com> wrote:
> Hey,
> I'm a rather new programmer, but it seems to me the digital to roman should
> be coded:
> While Digital_Input > 0:
> If Digital_Input > 1000 then: Roman = + M, Digital_Input = - 1000
> elif Digital_Input > 900 then: Roman = + C, Digital_Input = - 900
> ...
> Now if someone could please clarify [or forward me to clarifications of-]
> separation of data from logics I should be very grateful.

The idea is that our data is the information:
 1000 corresponds to 'M'
 500 corresponds to 'D'
 100 corresponds to 'C'
 etc..

We can represent that in python using a dictionary:

decToRomanData = { 1000:'M', 500:'D', 100:'C', 50:'L', 10:'X', 5:'V', 1:'I' }

Now we need to write some code that will take an integer and use our
data to convert to a Roman numeral.  One way we could do that is:

def decToRoman(dec):
        roman = ''
        while dec > 0:
                next = max(i for i in decToRomanData if dec >= i)
                roman += decToRomanData[next]
                dec -= next
        return roman

Now, if we suddenly remember that the romans used 'Q' to represent
250, we can just edit our dictionary, and the rest of the code will
remain the same.

[note that this code will not produce strings like 'IV' for 4.  OTOH,
as I recall, the Romans didn't do that consistently either..]

--

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Clay Wiedemann | 11 Mar 23:33
Picon

Re: problems to install python 2.5

No ideas there. I wish I could help, but I am new at this.
I did stop using IDLE though in favor of iPython. I don't know if an
end-around would solve all the problems you have been encountering
though.

http://ipython.scipy.org/moin/

-c

On 3/11/07, Tsila Hassine <tsila.hassine <at> gmail.com> wrote:
> yes I did download that, and it went " sorry can't update zshell" (and yes I
> have zshell) so i didn't know how to deal with that ....any ideas ? (but
> then i guess its a completely different problem then ...)
>
> thanks!
> T.
>
>
> On 3/11/07, Clay Wiedemann <clay.wiedemann <at> gmail.com> wrote:
> > Did you download the MacPython 2.5 distribution? You should find an
> > "Update shell profile.command" file, which you can run. I believe once
> > you do that, you will be set up so that IDLE will launch and you will
> > default to version 2.5.
> >
> > On 3/11/07, Tsila Hassine <tsila.hassine <at> gmail.com> wrote:
> > > Hello all
> > >
> > > I downloaded Python 2.5 (final release) from python.org. I am trying to
> > > install it on my Mac 0s 10.4
> > >
> > > the current working version i have of python is 2.3 (also built as a
> > > framework)
> > >
> > >
> > > It goes through the "./configure" part ok, but the "make install"
> produces
> > > the following errors :
> > >
> > >
> > >
> > > Modules/posixmodule.c:22: warning: ignoring #pragma weak lchown
> > > Modules/posixmodule.c:23: warning: ignoring #pragma weak statvfs
> > > Modules/posixmodule.c:24: warning: ignoring #pragma weak fstatvfs
> > > Modules/posixmodule.c: In function `posix_lchown':
> > > Modules/posixmodule.c:1681: warning: implicit declaration of function
> > > `lchown'
> > > Modules/posixmodule.c: In function `initposix':
> > > Modules/posixmodule.c:8588: error: `fstatvfs' undeclared (first use in
> this
> > > function)
> > > Modules/posixmodule.c:8588: error: (Each undeclared identifier is
> reported
> > > only once
> > > Modules/posixmodule.c:8588: error: for each function it appears in.)
> > > Modules/posixmodule.c:8596: error: `statvfs' undeclared (first use in
> this
> > > function)
> > > Modules/posixmodule.c:8604: error: `lchown' undeclared (first use in
> this
> > > function)
> > > make: *** [Modules/posixmodule.o] Error 1
> > >
> > >
> > > I can't find any documentation of such a problem on the net, does anyone
> > > have a clue to what might be the problem ?
> > >
> > > thanks!
> > > Tsila
> > >
> > > _______________________________________________
> > > Tutor maillist  -  Tutor <at> python.org
> > > http://mail.python.org/mailman/listinfo/tutor
> > >
> > >
> >
> >
> > --
> >
> > - - - - - - -
> >
> > Clay S. Wiedemann
> >
> > voice: 718.362.0375
> > aim: khlav
> > wii: 3905 4571 6175 2469
> > twitter: seastokes
> >
>
>

--

-- 

- - - - - - -

Clay S. Wiedemann

voice: 718.362.0375
aim: khlav
wii: 3905 4571 6175 2469
twitter: seastokes
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Kent Johnson | 11 Mar 23:39
Gravatar

Re: problems to install python 2.5

Tsila Hassine wrote:
> yes I did download that, and it went " sorry can't update zshell" (and 
> yes I
> have zshell) so i didn't know how to deal with that ....any ideas ? (but
> then i guess its a completely different problem then ...)

All that program does is make sure that the bin directory included in 
the Python distribution is included in your path. For bash, it edits 
.bash_profile and inserts this line:

export 
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"

You should do the equivalent for zshell.

Kent
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Kent Johnson | 12 Mar 00:20
Gravatar

Re: The whole Roman to Dec and vice versa issue

John Fouhy wrote:
> On 12/03/07, Jaggo <jaggojaggo <at> yahoo.com> wrote:
>> Hey,
>> I'm a rather new programmer, but it seems to me the digital to roman should
>> be coded:
>> While Digital_Input > 0:
>> If Digital_Input > 1000 then: Roman = + M, Digital_Input = - 1000
>> elif Digital_Input > 900 then: Roman = + C, Digital_Input = - 900
>> ...
>> Now if someone could please clarify [or forward me to clarifications of-]
>> separation of data from logics I should be very grateful.
> 
> The idea is that our data is the information:
>  1000 corresponds to 'M'
>  500 corresponds to 'D'
>  100 corresponds to 'C'
>  etc..
> 
> We can represent that in python using a dictionary:
> 
> decToRomanData = { 1000:'M', 500:'D', 100:'C', 50:'L', 10:'X', 5:'V', 1:'I' }

A list would probably work better here because the order is significant 
and random lookup is not.
> 
> Now we need to write some code that will take an integer and use our
> data to convert to a Roman numeral.  One way we could do that is:
> 
> def decToRoman(dec):
>         roman = ''
>         while dec > 0:
>                 next = max(i for i in decToRomanData if dec >= i)
>                 roman += decToRomanData[next]
>                 dec -= next
>         return roman

Remember this thread started as a homework problem...we shouldn't give 
solutions until the OP has one already. Then we can all get clever and 
show how we would have done it :-)
> 
> Now, if we suddenly remember that the romans used 'Q' to represent
> 250, we can just edit our dictionary, and the rest of the code will
> remain the same.
> 
> [note that this code will not produce strings like 'IV' for 4.  OTOH,
> as I recall, the Romans didn't do that consistently either..]

It seems to me that isn't so different from deciding to use 'Q' for 250. 
Maybe you can change the dictionary for this one too.

Kent
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

John Fouhy | 12 Mar 00:50
Gravatar

Re: The whole Roman to Dec and vice versa issue

On 12/03/07, Kent Johnson <kent37 <at> tds.net> wrote:
> > [note that this code will not produce strings like 'IV' for 4.  OTOH,
> > as I recall, the Romans didn't do that consistently either..]
> It seems to me that isn't so different from deciding to use 'Q' for 250.
> Maybe you can change the dictionary for this one too.

Ahh, good point.  I was thinking in terms of extra logic to figure out
the subtraction rules, but you could just use extra symbols :-)

--

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

shawn bright | 12 Mar 02:23
Picon

how to send command line args to py script

lo there all,

i was wondering how to make a python script accept command line arguments.
i mean, i have used python scripts from the command line in linux and
passed something to it and it knows what to do.

like in a function, if i want to do something like this

def add_two_numbers(a, b):
    x = a + b
    return x

x = add_two_numbers(4,5)
print x

how could i do the same from the cli.

like python add_two_numbers.py 4 5
or maybe python add_two_numbers.py 4, 5
or even python add_two_numbers.py -a 4 -b 5

is there an easy way to do this ?

thanks
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Alan Gilfoy | 12 Mar 02:44

Roman Numeral - To - Digital Converter

Roman Numeral - To - Digital Converter

So far, I'm coming along OK with the code that runs the conversions,  
assuming the user gives me a proper input. (A string of capital  
letters I, V, X, L, C, D, M)

However, not every input someone gives the function is goign to be  
properly formatted like that.

So:

1. How do I have my function "screen" an input string for characters  
that aren't I,V,X,L,C,D or M?
2. If any of the characters in the string are merely lowercase  
i,v,x,l,c,d, or m, how would I tell Python to capitalize those and go  
on with working the function?
--

-- 
"Blind faith in bad leadership is not patriotism."

"One of the most horrible features of war is that all the war-propaganda, all
the screaming and lies and hatred, comes invariably from people who are not
fighting."-George Orwell, _Homage to Catalonia

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Gordon | 12 Mar 02:55
Picon

Re: how to send command line args to py script

This is my first time replying to the list, so excuse me if this goes 
out wrong.

Anyhow, you're looking for sys.agrv.  sys.agrv is a list of the 
arguments, with sys.agrv[0] being the script name.

Code:
##########
import sys  #sys.argv is part of the sys module
def add_two_numbers(a, b):
    x = a + b
    return x
y = float(sys.argv[1]) #This gets the arguments and converts them to numbers
z = float(sys.argv[2]) #You need to do this because the arguments come 
as strings
x = add_two_numbers(y,z) #Of course, that means if you put in "python 
add.py 1 fish"
print x #you'll get an error.  So a try-except clause would be good here.
##########
Run the above script with the formatting "python (filename).py 1 1", not 
"python (filename).py -1 -1", that'll get you negative numbers.

shawn bright wrote:
> lo there all,
>
> i was wondering how to make a python script accept command line arguments.
> i mean, i have used python scripts from the command line in linux and
> passed something to it and it knows what to do.
>
> like in a function, if i want to do something like this
>
> def add_two_numbers(a, b):
>     x = a + b
>     return x
>
> x = add_two_numbers(4,5)
> print x
>
> how could i do the same from the cli.
>
> like python add_two_numbers.py 4 5
> or maybe python add_two_numbers.py 4, 5
> or even python add_two_numbers.py -a 4 -b 5
>
> is there an easy way to do this ?
>
> thanks
> _______________________________________________
> Tutor maillist  -  Tutor <at> python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>   

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor


Gmane