Re: PEP 450 Adding a statistics module to Python

2013-08-09 Thread Ben Finney
Skip Montanaro writes: > Given that installing numpy or scipy is generally no more difficult > that executing "pip install (scipy|numpy)" I'm not really feeling the > need for a battery here... NumPy and SciPy are not available for many Python users, including those using a Python implementation

Re: connection change

2013-08-09 Thread Joel Goldstick
On Fri, Aug 9, 2013 at 7:31 PM, Dennis Lee Bieber wrote: > On Fri, 9 Aug 2013 14:36:54 -0400, Joel Goldstick > declaimed the following: > > >> >>Have you tried to change your program to use mysql instead? If so, >>show the changes you made and what the results were. >> > > Pardon? "mssql

Re: PEP 450 Adding a statistics module to Python

2013-08-09 Thread Skip Montanaro
On Fri, Aug 9, 2013 at 8:10 PM, Steven D'Aprano wrote: > I am seeking comments on PEP 450, Adding a statistics module to Python's > standard library: > > http://www.python.org/dev/peps/pep-0450/ > > Please read the FAQs before asking anything :-) Given that installing numpy or scipy is generally

Re: beginner question (True False help)

2013-08-09 Thread Steven D'Aprano
On Fri, 09 Aug 2013 16:34:48 -0700, eschneider92 wrote: > What does global mean? Hi eschneider92, A few bits of advice: - You may like to actually sign your emails with a real name, or at least an alias that you want to be called, otherwise we'll just call you by your email address, and apar

Re: right adjusted strings containing umlauts

2013-08-09 Thread Steven D'Aprano
On Thu, 08 Aug 2013 17:24:49 +0200, Kurt Mueller wrote: > What do I do, when input_strings/output_list has other codings like > iso-8859-1? When reading from a text file, honour some sort of encoding cookie at the top (or bottom) of the file, like Emacs and Vim use, or a BOM. If there is no enc

Re: beginner question (True False help)

2013-08-09 Thread Joshua Landau
On 10 August 2013 00:34, wrote: > What does global mean? Python has "scopes" for its variables. Most programming languages do. A "scope" is a restriction on where variables exist -- they exist only within the scope. This can be seen in this example: def function(): # A new "scope"

PEP 450 Adding a statistics module to Python

2013-08-09 Thread Steven D'Aprano
I am seeking comments on PEP 450, Adding a statistics module to Python's standard library: http://www.python.org/dev/peps/pep-0450/ Please read the FAQs before asking anything :-) Also relevant: http://bugs.python.org/issue18606 -- Steven -- http://mail.python.org/mailman/listinfo/python

Re: beginner question (True False help)

2013-08-09 Thread eschneider92
I'm sorry, but I still don't understand how it applies to my problem. Thanks for everyone's patience. -- http://mail.python.org/mailman/listinfo/python-list

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-09 Thread Gregory Ewing
Luca Cerone wrote: Thanks! I managed to make it work using the threading library :) If at least one of the external programs can accept the source or destination as a filename argument instead of redirecting its stdin or stdout, you can also do something like this: import subprocess p2 = subp

Re: beginner question (True False help)

2013-08-09 Thread MRAB
On 10/08/2013 00:40, eschneide...@comcast.net wrote: (I forgot to post this with my last post.) Also, I don't understand any part of the following example, so there's no specific line that's confusing me. Thanks for the help btw. You don't understand _any_ of it? > var = 42 Here you're assi

Re: beginner question (True False help)

2013-08-09 Thread eschneider92
(I forgot to post this with my last post.) Also, I don't understand any part of the following example, so there's no specific line that's confusing me. Thanks for the help btw. var = 42 def myfunc(): var = 90 print "before:", var myfunc() print "after:", var def myfunc(): globa

Re: beginner question (True False help)

2013-08-09 Thread eschneider92
(I forgot to post this with my last post.) Also, I don't understand any part of the following example, so there's no specific line that's confusing me. Thanks for the help btw. var = 42 def myfunc(): var = 90 print "before:", var myfunc() print "after:", var def myfunc(): glo

Re: beginner question (True False help)

2013-08-09 Thread eschneider92
What does global mean? -- http://mail.python.org/mailman/listinfo/python-list

Re: beginner question (True False help)

2013-08-09 Thread Joshua Landau
On 10 August 2013 00:14, wrote: > I don't understand any of the advice any of you have given. What about it don't you understand? Pick a sentence you don't understand and throw it back at us. If you understand all the sentences but not how they come together, say so. If there's a leap that you d

Re: beginner question (True False help)

2013-08-09 Thread eschneider92
Thanks, though me not utilizing any of the other advice wasn't from lack of trying; I couldn't understand any of it. I get it now that I have a corrrect example code in front of me. -- http://mail.python.org/mailman/listinfo/python-list

Re: beginner question (True False help)

2013-08-09 Thread eschneider92
I don't understand any of the advice any of you have given. -- http://mail.python.org/mailman/listinfo/python-list

Re: beginner question (True False help)

2013-08-09 Thread Joshua Landau
On 9 August 2013 23:27, wrote: > This is what I ended up with btw. Does this insult anyone's more well attuned > Python sensibilities? ... Yes. You didn't listen to any of the advice we've been giving you. You've had *much* better answers given than this. Start from the top. We need letter

Re: beginner question (True False help)

2013-08-09 Thread eschneider92
This is what I ended up with btw. Does this insult anyone's more well attuned Python sensibilities? letters='abcdefghijkl' def repeat(): print('wanna go again?') batman=input() if batman in ('y','yes'): main() else: return def main(): print('guess a letter')

Re: beginner question (True False help)

2013-08-09 Thread eschneider92
This is what I ended up with btw. Does this insult anyone's more well-attuned Pythonic sensibilities? letters='abcdefghijkl' def repeat(): print('wanna go again?') batman=input() if batman in ('y','yes'): main() else: return def main(): print('guess a

RE: Python3 Multiprocessing

2013-08-09 Thread Prasad, Ramit
Devyn Collier Johnson > On 08/09/2013 03:44 PM, MRAB wrote: > > On 09/08/2013 20:30, Devyn Collier Johnson wrote: [snip] > >> > > jobs1.join() > > jobs2.join() > > > > Thanks MRAB! That is easy. I always (incorrectly) thought the join() > command got two threads and made them one. I did not know i

Re: Python3 Multiprocessing

2013-08-09 Thread random832
On Fri, Aug 9, 2013, at 16:43, Devyn Collier Johnson wrote: > Thanks MRAB! That is easy. I always (incorrectly) thought the join() > command got two threads and made them one. I did not know it made the > script wait for the threads. What you're missing is the fact that the main thread [i.e. the

Re: Python3 Multiprocessing

2013-08-09 Thread Devyn Collier Johnson
On 08/09/2013 03:44 PM, MRAB wrote: On 09/08/2013 20:30, Devyn Collier Johnson wrote: Aloha! I need a command that will make threads created by "multiprocessing.Process()" wait for each other to complete. For instance, I want to do something like this: job1 = multiprocessing.Process(CMD1

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Nobody
On Fri, 09 Aug 2013 21:12:20 +0100, Nobody wrote: > Try: > > command = ['sudo', 'tee', config_file] > p = subprocess.Popen(command, stdout=subprocess.PIPE, > stderr=subprocess.PIPE) > out, _ = p.communicate('channel') Oops; you also need stdin=subprocess.PIPE. -- http://mail.python.org/m

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Nobody
On Thu, 08 Aug 2013 23:11:09 -0500, Adam Mercer wrote: > I'm trying to write a script that writes some content to a file root > through sudo, but it's not working at all. I am using: > command = ['echo', '-n', channel, '|', 'sudo', 'tee', config_file] You can't create a pipeline like this. All

Re: Python3 Multiprocessing

2013-08-09 Thread MRAB
On 09/08/2013 20:30, Devyn Collier Johnson wrote: Aloha! I need a command that will make threads created by "multiprocessing.Process()" wait for each other to complete. For instance, I want to do something like this: job1 = multiprocessing.Process(CMD1()) job2 = multiprocessing.Process(CMD

Python3 Multiprocessing

2013-08-09 Thread Devyn Collier Johnson
Aloha! I need a command that will make threads created by "multiprocessing.Process()" wait for each other to complete. For instance, I want to do something like this: job1 = multiprocessing.Process(CMD1()) job2 = multiprocessing.Process(CMD2()) jobs1.start(); jobs2.start() PY_FUNC() The

Re: connection change

2013-08-09 Thread Joel Goldstick
On Thu, Aug 8, 2013 at 10:23 PM, Inna Belakhova wrote: > Hi, > > > > I have a compiled code, which currently uses SQLITE connection (datastore). I don't understand 'compiled code'. It would be nice if you show the code, give the version of python you are using, and the operating system Have you

Re: Python 3 and SSH Tunnel

2013-08-09 Thread Bernd Waterkamp
D. Xenakis schrieb: > I've played with putty to achieve this but to be honest i'd like > something more efficient. Opening putty everytime and making all the > connection settings etc, and then running the programm, is kinda messy. > Id like this to be done in an automatic way from the program so

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread David
On 9 August 2013 23:21, Adam Mercer wrote: > On Thu, Aug 8, 2013 at 11:47 PM, David wrote: > >> At a quick glance, I have a couple of suggestions. >> >>> command = ['echo', '-n', channel, '|', 'sudo', 'tee', config_file] >> >> sudo doesn't work like this. It doesn't read from standard input. Yo

Re: Data transfer from Python CGI to javascript

2013-08-09 Thread MRAB
On 09/08/2013 07:53, e...@cleantechsolution.in wrote: I have written the following program #!c:\Python27\Python.exe import cgi, cgitb; import sys, serial cgitb.enable() ser = serial.Serial('COM27', 9600) myvar = ser.readline() print "Content-type:text/html\n\n" print """ Real Time Temperature

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Chris Angelico
On Fri, Aug 9, 2013 at 2:50 PM, Adam Mercer wrote: > On Fri, Aug 9, 2013 at 8:42 AM, Antoon Pardon > wrote: > >> That is probably beside the point. I suspect Adam is just giving a >> minimal example to show the kind of thing he is trying to do. >> >> Nit picking the specific example instead of ad

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Antoon Pardon
Op 09-08-13 06:11, Adam Mercer schreef: > Hi > > I'm trying to write a script that writes some content to a file root > through sudo, but it's not working at all. I am using: > > channel = 'stable' > config_file = '/opt/ldg/etc/channel.conf' > command = ['echo', '-n', channel, '|', 'sudo',

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Adam Mercer
On Fri, Aug 9, 2013 at 8:42 AM, Antoon Pardon wrote: > That is probably beside the point. I suspect Adam is just giving a > minimal example to show the kind of thing he is trying to do. > > Nit picking the specific example instead of advising on the problem > is likely to be less than helpful. I

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Adam Mercer
On Fri, Aug 9, 2013 at 8:29 AM, Chris Angelico wrote: > You shouldn't need to use 'echo' here. Just provide tee with the text > on its standard input, and don't bother with the pipe at all. Thanks, that's much better! Cheers Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Antoon Pardon
Op 09-08-13 15:29, Chris Angelico schreef: > On Fri, Aug 9, 2013 at 2:21 PM, Adam Mercer wrote: >> command="echo -n %s | sudo tee %s > /dev/null" % (channel, config_file) >> > > You shouldn't need to use 'echo' here. Just provide tee with the text > on its standard input, and don't bother with th

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Chris Angelico
On Fri, Aug 9, 2013 at 2:21 PM, Adam Mercer wrote: > command="echo -n %s | sudo tee %s > /dev/null" % (channel, config_file) > You shouldn't need to use 'echo' here. Just provide tee with the text on its standard input, and don't bother with the pipe at all. ChrisA -- http://mail.python.org/ma

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Adam Mercer
On Thu, Aug 8, 2013 at 11:47 PM, David wrote: > At a quick glance, I have a couple of suggestions. > >> command = ['echo', '-n', channel, '|', 'sudo', 'tee', config_file] > > sudo doesn't work like this. It doesn't read from standard input. You > need to supply the command as an argument to sud

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread ishish
Am 09.08.2013 05:47, schrieb David: On 9 August 2013 14:11, Adam Mercer wrote: I'm trying to write a script that writes some content to a file root through sudo, but it's not working at all. I am using: [...] At a quick glance, I have a couple of suggestions. command = ['echo', '-n', ch

Re: passing Python data to a javascript function

2013-08-09 Thread engg
On Thursday, October 27, 2011 9:25:28 AM UTC+5:30, Chris Angelico wrote: > On Thu, Oct 27, 2011 at 2:51 PM, Bill Allen wrote: > > > Chris, > > > > > > Wow, that seems so simple now that I see it.  I was dancing around that all > > > day, but just not landing on it.   Thanks so very much for th

Re: right adjusted strings containing umlauts

2013-08-09 Thread wxjmfauth
Le jeudi 8 août 2013 18:27:06 UTC+2, Kurt Mueller a écrit : > Now I have this small example: > > -- > > #!/usr/bin/env python > > # vim: set fileencoding=utf-8 : > > > > from __future__ import print_function > > import sys, shlex > >

"Nested" virtual environments

2013-08-09 Thread Luca Cerone
Dear all, is there a way to "nest" virtual environments? I work on several different projects that involve Python programming. For a lot of this projects I have to use the same packages (e.g. numpy, scipy, matplotlib and so on), while having to install packages that are specific for each project

connection change

2013-08-09 Thread Inna Belakhova
Hi, I have a compiled code, which currently uses SQLITE connection (datastore). I was wondering if it is possible to change the connection string to use SQL Server database. I would like to export the datastore to SQL server database, as we are having issues with the sqlite limit. Thank

Re: beginner question (True False help)

2013-08-09 Thread wxjmfauth
Le jeudi 8 août 2013 22:29:00 UTC+2, Terry Reedy a écrit : > On 8/8/2013 7:41 AM, Chris Angelico wrote: > > > On Thu, Aug 8, 2013 at 7:20 AM, wrote: > > > def z2(): > > >> ... letters = 'abc' > > >> ... while True: > > >> ... c = input('letter: ') > > >> ... if c

Data transfer from Python CGI to javascript

2013-08-09 Thread engg
I have written the following program #!c:\Python27\Python.exe import cgi, cgitb; import sys, serial cgitb.enable() ser = serial.Serial('COM27', 9600) myvar = ser.readline() print "Content-type:text/html\n\n" print """ Real Time Temperature window.onload = startInterval; function sta