Aaron G. writes:
> I am new to programming python for JSON to SQL and I was wondering
> why this does not work. All the values for entering the DB are
> correct. The EnterpriseValue data is not entering the database.
>
> #collect data from JSON source at Yahoo
> url = ["db", "http://y.ahoo.it/wl
In Python 3 the following two classes should be equivalent:
$ cat foo.py
class Foo:
def foo():
pass
print(callable(foo))
class Foo:
@staticmethod
def foo():
pass
print(callable(foo))
But they do not:
$ python3 foo.py
True
False
How come the metaclass does n
Aaron G. wrote:
> I am new to programming python for JSON to SQL and I was wondering why
> this does not work. All the values for entering the DB are correct. The
> EnterpriseValue data is not entering the database.
> #collect data from JSON source at Yahoo
> url = ["db", "http://y.ahoo.it/wlB89"
Marco Buttu wrote:
> In Python 3 the following two classes should be equivalent:
Says who?
> $ cat foo.py
> class Foo:
> def foo():
> pass
> print(callable(foo))
>
> class Foo:
> @staticmethod
> def foo():
> pass
> print(callable(foo))
>
> But they do
Seems like the following pattern must be very common, solved a million
times, but I can't seem to find anything this simple and ready to use.
Basically I just want a simple python messaging layer that hides some of
the messiness of the underlying sockets and user authentication. It
would be asy
On 11/23/2013 10:01 AM, Peter Otten wrote:
In Python 3 the following two classes should be equivalent:
Says who?
>$ cat foo.py
>class Foo:
> def foo():
> pass
> print(callable(foo))
>
>class Foo:
> @staticmethod
> def foo():
> pass
> print(callable(f
I want to show simple dots while my program copies the files. I have found the
code like:
for i in range(10):
print '.',
time.sleep(1)
But this will execute ten times as it is predefined and the task to copy will
execute after or before this loop based on the location I have placed my
On Saturday, November 23, 2013 6:36:28 AM UTC-5, Himanshu Garg wrote:
> I want to show simple dots while my program copies the files. I have found
> the code like:
>
> for i in range(10):
> print '.',
> time.sleep(1)
>
> But this will execute ten times as it is predefined and the task t
for i in range(10):
sys.stdout.write(".")
sys.stdout.flush()
time.sleep(1)
sys.stdout.write("\n")
shutil.copytree("pack", "/lxc/pack")
But Here, the loop will first print the progress dots and then it will copy the
directory. But I want that these two tasks should r
"Himanshu Garg" wrote in message
news:b4b7cf70-07fa-455a-b01f-cb69b9402...@googlegroups.com...
>I want to show simple dots while my program copies the files. I have found
>the code like:
>
> for i in range(10):
>print '.',
>time.sleep(1)
>
> But this will execute ten times as it is pre
Thanks a lot Frank! Its superb. I got what I wanted. Thanks Again!
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, Nov 23, 2013 at 11:11 PM, Frank Millman wrote:
> class ProgressBar(threading.Thread):
> """
> In a separate thread, print dots to the screen until terminated.
> """
It's worth noting that this, as coded, is not a progress bar but
merely an activity bar. The number of dots prin
How can I write to the same file from two different scripts opened at same time?
--
https://mail.python.org/mailman/listinfo/python-list
Hi all
I have a question arising from another thread, but on a different topic,
hence the new thread.
Under Python2, if you want to print a series of dots to the screen without a
newline, you can do the following:
for i in range(10):
sys.stdout.write('.')
sys.stdout.flush()
time.sleep(1)
Hi all,
I am the author of the ``future`` package for Python 2/3 compatibility
(http://python-future.org). A bug report has recently been posted about its use
of import hooks that I don't yet have an answer for, and I am looking for some
guidance on how to customize the import mechanism in a s
On Sat, 23 Nov 2013 09:28:43 +0100, Marco Buttu wrote:
> In Python 3 the following two classes should be equivalent:
They certainly are not equivalent in *any* version of Python, because
staticmethods are not equivalent to instance methods.
> $ cat foo.py
> class Foo:
> def foo():
>
On Nov 23, 2013, at 1:42 AM, Ian Kelly wrote:
> On Fri, Nov 22, 2013 at 7:18 PM, Steven D'Aprano
> wrote:
>> I'm not an expert on Indian English, but I understand that in that
>> dialect it is grammatically correct to say "the codes", just as in UK and
>> US English it is grammatically correct t
On Sun, Nov 24, 2013 at 12:26 AM, Frank Millman wrote:
> for i in range(10):
> sys.stdout.write('.')
> sys.stdout.flush()
> time.sleep(1)
> sys.stdout.write('\n')
>
> I tried it under Python3, and found that it differs in two ways -
>
> 1. Each 'write' is terminated by a newline
> 2. Each 'w
On 23/11/2013 02:18, Steven D'Aprano wrote:
In other words, in UK/US English,
UK English? Clearly you've never been to Newcastle upon Tyne or Glasgow :)
--
Python is the second best programming language in the world.
But the best has yet to be invented. Christian Tismer
Mark Lawrence
--
h
On 23/11/2013 12:23, Ed Schofield wrote:
Hi all,
I am the author of the ``future`` package for Python 2/3 compatibility
(http://python-future.org). A bug report has recently been posted about its use
of import hooks that I don't yet have an answer for, and I am looking for some
guidance on ho
Hi,
I have a masked array like in the attached link, I wanted to find
indices of the bounds where the mask is false ie in this case of depth file
where there is depth less than shore. Is there a pythonic way of finding the
boundary indices? please advice?
https://drive.google.com/file
On Sun, Nov 24, 2013 at 1:29 AM, Sudheer Joseph wrote:
> Hi,
>I have a masked array like in the attached link, I wanted to find
> indices of the bounds where the mask is false ie in this case of depth file
> where there is depth less than shore. Is there a pythonic way of finding the
I'm trying to use sh (https://pypi.python.org/pypi/sh) for calling
system grep command but it's now working as expected.
An example:
import sh
sh.grep('abc', os.getcwd(), '-r')
But I get the ErrorReturnCode_1: exception, that I learned is the
normal exit code for grep command when it not
Marco Buttu wrote:
> On 11/23/2013 10:01 AM, Peter Otten wrote:
>
>>> In Python 3 the following two classes should be equivalent:
>> Says who?
>>
>>> >$ cat foo.py
>>> >class Foo:
>>> > def foo():
>>> > pass
>>> > print(callable(foo))
>>> >
>>> >class Foo:
>>> > @staticmet
In article ,
Luca wrote:
> I'm trying to use sh (https://pypi.python.org/pypi/sh) for calling
> system grep command but it's now working as expected.
>
> An example:
>
> import sh
> sh.grep('abc', os.getcwd(), '-r')
>
> But I get the ErrorReturnCode_1: exception, that I learned is the
OK, that one is disgusting...
Anyway, I'd like to see a sequence of method names taken from actual code
that profits from this chaining pattern.
Actually, wx.lib.agw uses this a lot. Especially for AuiPaneInfo:
http://www.wxpython.org/docs/api/wx.aui.AuiPaneInfo-class.html
All right, this
在 2013年11月20日星期三UTC+8下午10时49分50秒,Tim Golden写道:
> On 20/11/2013 14:44, iMath wrote:
>
> >
>
> >
>
> > is there anyway to run command line on Windows without showing DOS console
> > window ?
>
> >
>
> > can you use the following command line to give a little example ?
>
> >
>
> > wget -r
Luca wrote:
> I'm trying to use sh (https://pypi.python.org/pypi/sh) for calling
> system grep command but it's now working as expected.
>
> An example:
>
> import sh
> sh.grep('abc', os.getcwd(), '-r')
>
> But I get the ErrorReturnCode_1: exception, that I learned is the
> normal exit
On 2013-11-23 10:44, Dennis Lee Bieber wrote:
> On Fri, 22 Nov 2013 23:42:44 -0700, Ian Kelly
> declaimed the following:
> >
> >On Fri, Nov 22, 2013 at 8:47 PM, Dennis Lee Bieber
> > wrote:
> >>
> >> Rice is the plural of rouse
> >
> >Not according to the dictionary. But it does seem
By the same logic
the plural of spouse is spice and most men that have had more
than one wife will tell you that, whilst it may be the
expectation, it ain't necessarily so ;-)
On 23/11/2013 16:44, Dennis Lee Bieber
wrote:
On Fr
On Sun, Nov 24, 2013 at 3:35 AM, Tim Chase
wrote:
>> Mice/Mouse <> Rice/*Rouse
>
> Wordplay is one of my worst vouse. ;-)
Yeah, some people can come up with bad puns in a trouse.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On 23/11/2013 17:35, Chris Angelico wrote:
On Sun, Nov 24, 2013 at 3:35 AM, Tim Chase
wrote:
Mice/Mouse <> Rice/*Rouse
Wordplay is one of my worst vouse. ;-)
Yeah, some people can come up with bad puns in a trouse.
ChrisA
Well! That wasn't very nouse!
--
https://mail.python.org/ma
On Sat, Nov 23, 2013 at 5:29 PM, Peter Otten <__pete...@web.de> wrote:
> Luca wrote:
>
>> I'm trying to use sh (https://pypi.python.org/pypi/sh) for calling
>> system grep command but it's now working as expected.
>>
>> An example:
>>
>> import sh
>> sh.grep('abc', os.getcwd(), '-r')
>>
>>
On Sat, 23 Nov 2013 02:18:03 +, Steven D'Aprano wrote:
> On Sat, 23 Nov 2013 01:55:44 +, Denis McMahon wrote:
>> On Fri, 22 Nov 2013 18:22:29 +0530, Bharath Kummar wrote:
>>> Could you PLEASE provide me with the codes (codes only for the asked
>>> queries) ?
>> The codes are:
>> 1) 7373a
On 22/11/2013 11:26, Steven D'Aprano wrote:
A frequently missed feature is the ability to chain method calls:
x = []
x.append(1).append(2).append(3).reverse().append(4)
=> x now equals [3, 2, 1, 4]
This doesn't work with lists, as the methods return None rather than
self. The class needs to be
Thanks a lot for your helpful posts, Terry!
On 11/23/2013 01:00 AM, Terry Reedy wrote:
* Make the task function a parameter 'func'.
I actually like subclassing, but yes I know there are some downsides :)
* Rename start to _set to better describe what is does and call it in
the _run function
Op 23-11-13 10:01, Peter Otten schreef:
>
> Your script is saying that a staticmethod instance is not a callable object.
> It need not be because
>
> Foo.foo()
>
> doesn't call the Foo.foo attribute directly, it calls
>
> Foo.foo.__get__(None, Foo)()
I think you are burdening the programmer
On Sun, Nov 24, 2013 at 2:00 AM, Antoon Pardon
wrote:
> IMO if Foo.foo() is legal then Foo.foo is callable. That the actual call
> is delegated to Foo.foo.__get__(None, Foo) shouldn't matter.
I absolutely agree. But isn't that already the case? I seem to be
missing something here.
>>> class Foo:
Antoon Pardon wrote:
> Op 23-11-13 10:01, Peter Otten schreef:
>
>>
>> Your script is saying that a staticmethod instance is not a callable
>> object. It need not be because
>>
>> Foo.foo()
>>
>> doesn't call the Foo.foo attribute directly, it calls
>>
>> Foo.foo.__get__(None, Foo)()
>
> I t
On Friday, November 22, 2013 8:18:03 PM UTC-6, Steven D'Aprano wrote:
> [snip] I look forward to the day that "rice" is the plural of "ri"
Yes and i look forward to the day when "thread hijacking" perpetrated under the
guise of "exploring linguistic minutia" perpetrated under the guise of "vanit
data = sock.recv(RECV_BUFFER)
username = str(sock.getpeername())
username = usernames[username]
if command == "/quit":
print data
sock.send("bye"
On Sun, Nov 24, 2013 at 9:15 AM, Bhanu Karthik
wrote:
> data = sock.recv(RECV_BUFFER)
> username = str(sock.getpeername())
> username = usernames[username]
> if command == "/quit":
>
On Saturday, 23 November 2013 14:23:08 UTC-8, Chris Angelico wrote:
> On Sun, Nov 24, 2013 at 9:15 AM, Bhanu Karthik
>
> wrote:
>
> > data = sock.recv(RECV_BUFFER)
>
> > username = str(sock.getpeername())
>
> > username = usernames[usern
On Sun, Nov 24, 2013 at 9:29 AM, Bhanu Karthik
wrote:
> sorry its not command its data
>
> I miss wrote it here...
Okay. Start by copying and pasting your actual code, and saying what
you're doing to trigger it. If this is a stream socket (eg TCP), you
have no way of knowing where one read wi
On Saturday, 23 November 2013 14:23:08 UTC-8, Chris Angelico wrote:
> On Sun, Nov 24, 2013 at 9:15 AM, Bhanu Karthik
>
> wrote:
>
> > data = sock.recv(RECV_BUFFER)
>
> > username = str(sock.getpeername())
>
> > username = usernames[usern
In article <8445e47e-7efe-4f37-9b40-db2896d58...@googlegroups.com>,
Bhanu Karthik wrote:
> data = sock.recv(RECV_BUFFER)
> username = str(sock.getpeername())
> username = usernames[username]
> if data == "/quit"
On Sun, Nov 24, 2013 at 9:33 AM, Bhanu Karthik
wrote:
> this is exact code..
> it is not even entering the if ...
> I tried ( c= (data is '/quit')if c)
>
> when i print c ,its printing falseI dont understand what is
> happening...please help..
Again, please get off Google Groups. Have a look
On Saturday, 23 November 2013 14:37:09 UTC-8, Roy Smith wrote:
> In article <8445e47e-7efe-4f37-9b40-db2896d58...@googlegroups.com>,
>
> Bhanu Karthik wrote:
>
>
>
> > data = sock.recv(RECV_BUFFER)
>
> > username = str(sock.getpeername())
>
> >
On Sun, Nov 24, 2013 at 9:39 AM, Bhanu Karthik
wrote:
> indentation is correct when I trying to paste it here,it is showing like it
> is unindented.
That's because Google Groups mucks things up. Get a better client.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On 23/11/2013 22:29, Bhanu Karthik wrote:> On Saturday, 23 November 2013
14:23:08 UTC-8, Chris Angelico wrote:
>> On Sun, Nov 24, 2013 at 9:15 AM, Bhanu Karthik
>> wrote:
>> > data = sock.recv(RECV_BUFFER)
>> > username = str(sock.getpeername())
>> >
On Sat, 23 Nov 2013 05:11:11 -0800 (PST), Himanshu Garg
wrote:
How can I write to the same file from two different scripts opened
at same time?
Using what version of python and on what OS?
Sone OS's will open the file exclusively by default. Others will let
you stomp all over some other proc
On Friday, November 22, 2013 8:18:03 PM UTC-6, Steven D'Aprano wrote:
> As this is an international forum, it behoves us all to make allowances
> for slight difference in dialect.
I don't thank so. What purpose does that serve?
If we allow people to speak INCORRECT English under the
guise of "po
On 2013-11-23 15:06, Rick Johnson wrote:
> I don't thank so. What purpose does that serve?
>
> If we allow people to speak INCORRECT English under the
> guise of "political correctness" then no one will benefit.
"I don't thank so"?
talk about the plank in your own eye...
-tkc
--
https://mai
I mentioned some time ago about a program to calculate PID constants for
tuning controllers, follow the link to its online version algorithm for
anyone interested http://pastebin.com/wAqZmVnR
I thank you for the help I received from many here on the list. ;D
--
https://mail.python.org/mailman/list
On Sun, Nov 24, 2013 at 10:06 AM, Rick Johnson
wrote:
> On Friday, November 22, 2013 8:18:03 PM UTC-6, Steven D'Aprano wrote:
>> As this is an international forum, it behoves us all to make allowances
>> for slight difference in dialect.
>
> I don't thank so. What purpose does that serve?
> ...
>
On Fri, Nov 22, 2013 at 8:47 PM, Dennis Lee Bieber
wrote:
>
Rice is the plural of rouse
And spice is the plural of spouse. :-)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
Ian Kelly wrote:
I wouldn't necessarily even consider it an Indian thing, as I've known
Americans to use the same phrase.
In my experience it seems to be a scientific community
vs. computer science community thing. I often hear Fortran
people talk about "a code" where we would say "a library"
o
> I want that print "hello" should appear on screen as well as get saved in a
> log file.
> How can I accomplish this?
There are many ways to do this, here's one:
class MultiWriter(object):
def __init__(self, *writers):
self.writers = writers
self.isatty = False
def write
On 23/11/2013 19:53, Rotwang wrote:
[...]
That's pretty cool. However, I can imagine it would be nice for the
chained object to still be an instance of its original type. How about
something like this:
[crap code]
The above code isn't very good - it will only work on types whose
constructor wi
On 24/11/2013 00:28, Rotwang wrote:
[...]
This solves some of the problems in my earlier effort. It keeps a copy
of the original object,
Sorry, I meant that it keeps a reference to the original object.
--
https://mail.python.org/mailman/listinfo/python-list
Thank you very much, that's much more detailed than I dared to hope for, it's
going to be a great help. :) Since the course will begin in January, I'm just
starting to prepare, I'm happy to hear any other ideas, comments.
Thank you all,
Mate
--
https://mail.python.org/mailman/listinfo/python-
On Sat, 23 Nov 2013 15:06:42 -0800, Rick Johnson wrote:
> On Friday, November 22, 2013 8:18:03 PM UTC-6, Steven D'Aprano wrote:
>> As this is an international forum, it behoves us all to make allowances
>> for slight difference in dialect.
>
> I don't thank so. What purpose does that serve?
>
>
On Sat, 23 Nov 2013 04:23:42 +
MRAB wrote:
> On 23/11/2013 00:58, John O'Hagan wrote:
> > On Thu, 21 Nov 2013 12:59:26 -0800
> > Dan Stromberg wrote:
> >
> >> On Wed, Nov 20, 2013 at 10:46 PM, John O'Hagan
> >> wrote:
> >>
> >> >
> >> > Short story: the subject says it all, so if you have an
On Fri, 22 Nov 2013 22:33:29 -0800
Dan Stromberg wrote:
> On Fri, Nov 22, 2013 at 4:58 PM, John O'Hagan
> wrote:
>
> > On Thu, 21 Nov 2013 12:59:26 -0800
> > Dan Stromberg wrote:
> >
> > > On Wed, Nov 20, 2013 at 10:46 PM, John O'Hagan
> > > wrote:
> > >
> > > >
> > > > Short story: the subject
As part of a post on python-ideas, I wanted to knock together a quick
little script that "imports" a file based on its name, in the same way
that the Python interpreter will happily take an absolute pathname for
the main script. I'm sure there's a way to do it, but I don't know
how. Obviously the i
On Sat, Nov 23, 2013 at 7:41 PM, Chris Angelico wrote:
> As part of a post on python-ideas, I wanted to knock together a quick
> little script that "imports" a file based on its name, in the same way
> that the Python interpreter will happily take an absolute pathname for
> the main script. I'm su
I have simply opened file in append mode in linux.
script 1 :
file = open("output.log", "a")
file.write()
file.flush()
script 2:
file = open("output.log", "a")
file.write()
file.flush()
It writes properly to the file.
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, Nov 23, 2013 at 5:38 PM, Steven D'Aprano
wrote:
> Thank you for the lesson in the virtues of bluntness, and why politeness
> and political correctness is a vice. Never let it be said that I'm not
> willing to learn from you Rick, so keeping everything you said in mind,
> let me say this:
>
On Sun, Nov 24, 2013 at 6:32 PM, Devin Jeanpierre
wrote:
> On Sat, Nov 23, 2013 at 5:38 PM, Steven D'Aprano
> wrote:
>> Thank you for the lesson in the virtues of bluntness, and why politeness
>> and political correctness is a vice. Never let it be said that I'm not
>> willing to learn from you R
69 matches
Mail list logo