[Tutor] subprocessor startup error

2011-02-23 Thread anulavidyalaya
I have a problem when openning python (GUI) , There is a message "IDLE's 
subprocessor didn't make connection."
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] reading large text file as numpy array

2011-02-23 Thread Peter Otten
Jaidev Deshpande wrote:

> I have a large text file with more than 50k lines and about 784 floats in
> each line.
> 
> How can I read the whole file as a single numpy array?

Have you tried numpy.loadtxt()?


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] subprocessor startup error

2011-02-23 Thread Alan Gauld


"anulavidyalaya"  wrote 

I have a problem when openning python (GUI) , 
There is a message "IDLE's subprocessor didn't make connection."


Which version of Python on which Operating System?

This may be a firewall issue but I thought they had fixed 
that in recent versions of Python...


Alan G.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Concatenating string

2011-02-23 Thread Francesco Loffredo

On 23/02/2011 3.02, tee chwee liong wrote:

hi Francesco,

couldnt get hex of bin working on IDLE Python 2.5 when i type:

 >>> hex(0b1001001001001001001)
SyntaxError: invalid syntax
 >>> bin(0x49249)
Traceback (most recent call last):
File "", line 1, in 
bin(0x49249)
NameError: name 'bin' is not defined

pls advise.

Python 2.5 had no built-in binary conversion tools. bin() was introduced in 2.6.

The interesting questions are:
1- are you SURE you were using 2.5 yesterday?
If so:
2- did you import some modules? Which ones?
On my phone I have Python 2.5 too, and it gives the same errors to me.

Is it possible that you upgrade to 2.6 or 2.7 ?



thanks
tcl


You're welcome!
FAL


-
Nessun virus nel messaggio.
Controllato da AVG - www.avg.com
Versione: 10.0.1204 / Database dei virus: 1435/3460 -  Data di rilascio: 
22/02/2011

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] subprocessor startup error

2011-02-23 Thread Steven D'Aprano

anulavidyalaya wrote:

I have a problem when openning python (GUI) , There is a message "IDLE's 
subprocessor didn't make connection."


Google is your friend.

http://www.google.co.uk/search?hl=en&q=IDLE%27s+subprocess+didn%27t+make+connection

(By the way, don't re-type error messages, if you can avoid it. Copy and 
paste them. If you must re-type them, make sure you type them correctly 
-- it's not "subprocessor", but subprocess.)



What version of Python are you using, what operating system, what have 
you already  tried?



--
Steven

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Concatenating string

2011-02-23 Thread Joel Goldstick
On Tue, Feb 22, 2011 at 9:02 PM, tee chwee liong  wrote:

>  hi Francesco,
>
> couldnt get hex of bin working on IDLE Python 2.5 when i type:
>
> >>> hex(0b1001001001001001001)
> SyntaxError: invalid syntax
> >>> bin(0x49249)
>
> Traceback (most recent call last):
>   File "", line 1, in 
> bin(0x49249)
>
> NameError: name 'bin' is not defined
>
> pls advise.
>
> thanks
> tcl
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
bin is new   in 2.6 .. check your version

-- 
Joel Goldstick
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Concatenating string

2011-02-23 Thread tee chwee liong

> The interesting questions are:
> 1- are you SURE you were using 2.5 yesterday?
> If so:
> 2- did you import some modules? Which ones?
> On my phone I have Python 2.5 too, and it gives the same errors to me.
> 
> Is it possible that you upgrade to 2.6 or 2.7 ?
> 
 
hi,
 
yes i'm sure using Python 2.5 because that's the only version i have. however i 
was playing around on how to convert hex to bin, can't remember whether 
imported special module. 
anyway here is the code that converts hex to bin:
import binascii 
def byte_to_binary(n): 
return ''.join(str((n & (1 << i)) and 1) for i in reversed(range(8)))
def hex_to_binary(h): 
return ''.join(byte_to_binary(ord(b)) for b in binascii.unhexlify(h))
array0 = '000a0003c03c1f80'
a=hex_to_binary(array0)
print "a:",a

thanks
tcl
  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Convert bin to hex

2011-02-23 Thread tee chwee liong

hi, 
 
i have a script that converts hex to bin and bin to hex back. however, when 
converting back to hex the leading 0s are truncated. how to maintain the 
leading 0s? tq
 
import binascii
import string
def byte_to_binary(n): 
return ''.join(str((n & (1 << i)) and 1) for i in reversed(range(8))) 
 
def hex_to_binary(h): 
return ''.join(byte_to_binary(ord(b)) for b in binascii.unhexlify(h)) 
def bintohex(s):
return ''.join([ "%x"%string.atoi(bin,2) for bin in s.split() ])

array0 = '000a0003c03c1f80'
a=hex_to_binary(array0)
print "Convert array0 to bin:",a
print "Convert array0 back to hex:",bintohex(a)
if bintohex(a)==array0:
print "Match"
else:
print "Not match"

#result##
>>> 
Convert array0 to bin: 
1010001111011000
Convert array0 back to hex: a0003c03c1f80
Not match
>>>   ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Trouble installing numpy on QNX

2011-02-23 Thread Nelson Powell
I'm currently using QNX 6.4.1 with Python 2.5.  I went to install
numpy 1.4.1, but the install kicks bakc an error saying that it cannot
find Python.h and that I should install python-dev|python-devel.  I
look online and I can only find those two packages in relation to
Ubuntu, which obviously will not work.

Has anyone experienced this or know what's up?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PCA on sparse matrices, tolerance of eigenvalues

2011-02-23 Thread Jaidev Deshpande
Dear all,

I tried using the 'scipy.sparse.eigs' tool for performing principal
component analysis on a matrix which is roughly 80% sparse.

First of all, is that a good way to go about it?

Second, the operation failed when the function failed to converge on
accurate eigenvalues. I noticed the 'tol' attribute in the function, but how
does one define a reasonable tolerance and calculate it?

Thanks
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PCA on sparse matrices, tolerance of eigenvalues

2011-02-23 Thread Alan Gauld


"Jaidev Deshpande"  wrote


I tried using the 'scipy.sparse.eigs' tool for performing principal
component analysis on a matrix which is roughly 80% sparse.

First of all, is that a good way to go about it?


Umm, I remember the term eigenvalue from University math.
Other than that the first sentence could be in Chinese! :-)

I suspect you might get a better resoponse on a scipy
or numpy mailing list or forum. Although there are a few
users of that here it sounds like your queries are likely
to be more scipy oriented than general Python.

There is a list of options here:

http://www.scipy.org/Mailing_Lists


Second, the operation failed when the function failed to converge on
accurate eigenvalues. I noticed the 'tol' attribute in the function, 
but how

does one define a reasonable tolerance and calculate it?


Sorry, I understand the sentence this time but again
its more a scipy question than a Python one.

Alan G.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Convert string to long

2011-02-23 Thread tee chwee liong

hi, 
 
is there a way to convert from string to long? for eg: i want to concatenate 
all the arrays into data and make it same type (long) as data1. 
 
code:
a='0x'
array0 = '00180400'
array1 = ''
array2 = 'fe00'
array3 = '00ff'
data = a+array0+array1+array2+array3
print data
print type(data)
data1 = 
0x00180400feff
print type(data1)
 
###result:
0x00180400feff


##
 
thanks
tcl   ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] licensing python work?

2011-02-23 Thread Alex Hall
Hi all,
This is not strictly on topic and probably has a very obvious answer,
but I want to make sure I do it right. How do I license something I
write? I have that Bookshare wrapper done, at least as far as I can
tell, and I want to give it to Bookshare so they can provide it to
whomever wants it. Basically, anyone can copy or modify it in any way,
in part or in whole, whether they make money off it or not.
Realistically it seems pointless to make a big deal out of someone
making money off of this wrapper since it is only a few hundred lines.
What license do you recommend, and do I just point people to the
license in a comment in the code, or is there something else I have to
do? Thanks.

-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] licensing python work?

2011-02-23 Thread Wayne Werner
If you don't care how people use it at all, just release your code into the
public domain, then it doesn't matter how they use it.

HTH,
Wayne

On Wed, Feb 23, 2011 at 8:38 PM, Alex Hall  wrote:

> Hi all,
> This is not strictly on topic and probably has a very obvious answer,
> but I want to make sure I do it right. How do I license something I
> write? I have that Bookshare wrapper done, at least as far as I can
> tell, and I want to give it to Bookshare so they can provide it to
> whomever wants it. Basically, anyone can copy or modify it in any way,
> in part or in whole, whether they make money off it or not.
> Realistically it seems pointless to make a big deal out of someone
> making money off of this wrapper since it is only a few hundred lines.
> What license do you recommend, and do I just point people to the
> license in a comment in the code, or is there something else I have to
> do? Thanks.
>
> --
> Have a great day,
> Alex (msg sent from GMail website)
> mehg...@gmail.com; http://www.facebook.com/mehgcap
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] licensing python work?

2011-02-23 Thread David Hutto
Read the licenses, and see which one fits your needs, or just put your
own conditions at the top of each file. They can use it under your
stated terms.
http://www.google.com/search?client=ubuntu&channel=fs&q=open+source+licensing&ie=utf-8&oe=utf-8

On Wed, Feb 23, 2011 at 10:05 PM, Wayne Werner  wrote:
> If you don't care how people use it at all, just release your code into the
> public domain, then it doesn't matter how they use it.
> HTH,
> Wayne
>
> On Wed, Feb 23, 2011 at 8:38 PM, Alex Hall  wrote:
>>
>> Hi all,
>> This is not strictly on topic and probably has a very obvious answer,
>> but I want to make sure I do it right. How do I license something I
>> write? I have that Bookshare wrapper done, at least as far as I can
>> tell, and I want to give it to Bookshare so they can provide it to
>> whomever wants it. Basically, anyone can copy or modify it in any way,
>> in part or in whole, whether they make money off it or not.
>> Realistically it seems pointless to make a big deal out of someone
>> making money off of this wrapper since it is only a few hundred lines.
>> What license do you recommend, and do I just point people to the
>> license in a comment in the code, or is there something else I have to
>> do? Thanks.
>>
>> --
>> Have a great day,
>> Alex (msg sent from GMail website)
>> mehg...@gmail.com; http://www.facebook.com/mehgcap
>> ___
>> Tutor maillist  -  Tutor@python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>



-- 
According to theoretical physics, the division of spatial intervals as
the universe evolves gives rise to the fact that in another timeline,
your interdimensional counterpart received helpful advice from me...so
be eternally pleased for them.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] comparing strings

2011-02-23 Thread Edward Martinez

Hi,

I'm new to the list and programming.
i have a question, why when i evaluate strings ie 'a' > '3' it reports 
true,  how does python come up with  that?



Regards,
Edward
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] comparing strings

2011-02-23 Thread Corey Richardson
On 02/23/2011 10:22 PM, Edward Martinez wrote:
> Hi,
> 
> I'm new to the list and programming.
> i have a question, why when i evaluate strings ie 'a' > '3' it reports 
> true,  how does python come up with  that?

Welcome! As far as I know, it compares the value of the ord()'s.

>>>ord('a')
97
>>>ord('3')
51

This is their number in the ASCII system. You can also do this:

>>>chr(97)
'a'
>>>chr(51)
'3'

-- 
Corey Richardson
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] accessing another system's environment

2011-02-23 Thread Bill Allen
I know that I can use the following to get a listing of the environment of
my own system.   How can I do similar for another system on my network.
This is for administrative purposes.

>>> import os
>>> for param in os.environ.keys():
print(param, os.environ[param])

--Bill
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] comparing strings

2011-02-23 Thread Edward Martinez

On 02/23/11 19:29, Corey Richardson wrote:

On 02/23/2011 10:22 PM, Edward Martinez wrote:

Hi,

I'm new to the list and programming.
i have a question, why when i evaluate strings ie 'a'>  '3' it reports
true,  how does python come up with  that?

Welcome! As far as I know, it compares the value of the ord()'s.


ord('a')

97

ord('3')

51

This is their number in the ASCII system. You can also do this:


chr(97)

'a'

chr(51)

'3'


   Hi,
  Thank you!. I better read on   ASCII and unicode and try a few using  
char() and ord().


   Regards,
   Edward
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] licensing python work?

2011-02-23 Thread Chris Fuller

I'd recommend the Apache license, for BSD/X11/MIT type permissive licensing, 
because it's compatible with contributions to Python (maybe not this code, but 
you might want to contribute something else in the future).

http://wiki.python.org/moin/PythonSoftwareFoundationLicenseFaq#Contributing_Code_to_Python
http://www.opensource.org/licenses/apache2.0.php

Cheers


On Wednesday 23 February 2011, Alex Hall wrote:
> Hi all,
> This is not strictly on topic and probably has a very obvious answer,
> but I want to make sure I do it right. How do I license something I
> write? I have that Bookshare wrapper done, at least as far as I can
> tell, and I want to give it to Bookshare so they can provide it to
> whomever wants it. Basically, anyone can copy or modify it in any way,
> in part or in whole, whether they make money off it or not.
> Realistically it seems pointless to make a big deal out of someone
> making money off of this wrapper since it is only a few hundred lines.
> What license do you recommend, and do I just point people to the
> license in a comment in the code, or is there something else I have to
> do? Thanks.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] licensing python work?

2011-02-23 Thread David Hutto
Remember to check the licenses of what your wrapper utilizes.

According to theoretical physics, the division of spatial intervals as
the universe evolves gives rise to the fact that in another timeline,
your interdimensional counterpart received helpful advice from me...so
be eternally pleased for them.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] licensing python work?

2011-02-23 Thread David Hutto
And in the end it is called open source, for a reason, so if you're
not worried, just throw your name at the top, and don't even use a
license, unless you want your name to be kept, in which case you might
want to include"whether copied in whole, or part".

We all scavenge for examples, until we can do it ourselves, and even
then, when working with multiple interlanguage processes, you need
libraries of functions, references and examples to "vulturize".
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] licensing python work?

2011-02-23 Thread Chris Fuller

Invoking the public domain isn't as simple as you might naively think.  Tread 
with care!

http://www.linuxjournal.com/article/6225

Cheers


On Wednesday 23 February 2011, Wayne Werner wrote:
> If you don't care how people use it at all, just release your code into the
> public domain, then it doesn't matter how they use it.
> 
> HTH,
> Wayne
> 
> On Wed, Feb 23, 2011 at 8:38 PM, Alex Hall  wrote:
> > Hi all,
> > This is not strictly on topic and probably has a very obvious answer,
> > but I want to make sure I do it right. How do I license something I
> > write? I have that Bookshare wrapper done, at least as far as I can
> > tell, and I want to give it to Bookshare so they can provide it to
> > whomever wants it. Basically, anyone can copy or modify it in any way,
> > in part or in whole, whether they make money off it or not.
> > Realistically it seems pointless to make a big deal out of someone
> > making money off of this wrapper since it is only a few hundred lines.
> > What license do you recommend, and do I just point people to the
> > license in a comment in the code, or is there something else I have to
> > do? Thanks.
> > 
> > --
> > Have a great day,
> > Alex (msg sent from GMail website)
> > mehg...@gmail.com; http://www.facebook.com/mehgcap
> > ___
> > Tutor maillist  -  Tutor@python.org
> > To unsubscribe or change subscription options:
> > http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] licensing python work?

2011-02-23 Thread David Hutto
That's why I said to check the licenses from what you work upon(that
gives more insight into what license you should use, and how you use
it). More and more it's just docs, and functions for me, but
initially, all of your "great" beginner projects, utilize what you
find, and tutorials online are usually just that - scavengable.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] licensing python work?

2011-02-23 Thread Alex Hall
Thanks, everyone, for the feedback. I went with the suggestion of
adding my name to it, mentioning that I am not responsible for
anything that happens, a request for credit somewhere in an
application that uses the wrapper (though not a requirement), and
that's pretty much it. I think this thing has about five hundred
lines, so it is nothing too big, but hopefully it will help someone in
the future who goes googling for a python implementation of the
Bookshare api. Now to send it off...

On 2/23/11, David Hutto  wrote:
> That's why I said to check the licenses from what you work upon(that
> gives more insight into what license you should use, and how you use
> it). More and more it's just docs, and functions for me, but
> initially, all of your "great" beginner projects, utilize what you
> find, and tutorials online are usually just that - scavengable.
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor