Peter Otten <__pete...@web.de> writes:
> root = etree.fromstring(s)
> for server in root.xpath("./server"):
> servername = server.xpath("./name/text()")[0]
When working with lxml I prefer to use this Python idiom.
servername, = server.xpath("./name/text()")
That enforces a single result
On 10/27/2016 1:49 AM, Marko Rauhamaa wrote:
Terry Reedy :
On 10/26/2016 8:33 AM, Marko Rauhamaa wrote:
Maybe there should be some way to get the raw events from the PTY.
PTY? Must be Linux-specific. Most beginners are not on Linux.
A PTY is an emulated console (https://en.wikipedia.org/
Pete Forman wrote:
> Peter Otten <__pete...@web.de> writes:
>
>> root = etree.fromstring(s)
>> for server in root.xpath("./server"):
>> servername = server.xpath("./name/text()")[0]
>
> When working with lxml I prefer to use this Python idiom.
>
> servername, = server.xpath("./name/text
On 2016-10-27 03:05 AM, Terry Reedy wrote:
When I used unix in the 1980s, the full screen ran csh until one started
another full screen application. MSDOS was the same. Every contemporary
photo of modern Linux or Mac I have seen has a desktop with windows just
like Windows. Do people on Linux s
On 26.10.16 23:47, Peter Otten wrote:
def mynamereplace(exc):
return u"".join(
"\\N{%s}" % unicodedata.name(c)
for c in exc.object[exc.start:exc.end]
), exc.end
codecs.register_error("namereplace", mynamereplace)
Not all characters has standard na
Elizabeth Weiss wrote:
> words=["hello", "world", "spam", "eggs"]
> counter=0
> max_index=len(words)-1
>
> while counter<=max_index:
> word=words[counter]
> print(word + "!")
> counter=counter + 1
while 0 < 10:
get 0'th element
do something with element
increment 0 to 1
(repeat)
words[0
Good day,
I'm trying to run multiple SSH clients using AsyncSSH lib. This is an example
from manual, which works fine:
http://pastebin.com/zh4zymeQ
The problem is, it is not possible to directly set connect timeout in
run_client() function. However, the manual says:
"asyncio calls can be wrappe
Good day,
I'm trying to run multiple SSH clients using AsyncSSH lib. This is an example
from manual, which works fine: http://pastebin.com/zh4zymeQ
The problem is, it is not possible to directly set connect timeout in
run_client() function. However, the manual says:
"asyncio calls can be wrapped
On 10/26/2016 9:12 PM, BartC wrote:
On 27/10/2016 00:30, Terry Reedy wrote:
Bart, you appear to have been fortunate enough to be spoiled by learning
programming on microcomputers, where the terminal and computer are
combined into one unit, so that the computer, and potentially the
programmer,
Il 26/10/2016 16:18, jmp ha scritto:
On 10/26/2016 02:45 PM, pozz wrote:
Il 26/10/2016 13:16, jmp ha scritto:
[...]
I suggest you write a GUI that make synchronouscalls to a remote
application, if possible. If the remote app is in python, you have
access to remote protocols already written
Here is an example about threads and PyQT
https://www.youtube.com/watch?v=ivcxZSHL7jM&index=2
On 10/27/2016 01:22 PM, pozz wrote:
Il 26/10/2016 16:18, jmp ha scritto:
On 10/26/2016 02:45 PM, pozz wrote:
Il 26/10/2016 13:16, jmp ha scritto:
[...]
I suggest you write a GUI that make synchron
On 27/10/2016 07:51, Steven D'Aprano wrote:
On Thursday 27 October 2016 12:12, BartC wrote:
I don't
understand the argument that a language shouldn't have a basic keyboard
API because some computers it could run on might not have a keyboards.
That's not the argument. The argument is that Pyth
Terry Reedy :
> Do people on Linux still commonly use full-screen, no window text
> editors like the one I had?
I occasionally switch on one of the alternate VTs, which are not running
any GUI.
However, I constantly use -- in fact, as I type, I'm using -- a program
running in a PTY environment. I
BartC :
> "There's a room in your house with no door to it; how do I get in?"
>
> "There's no need for a door because no one ever uses that room! But
> you can get in through the chimney - if you /have/ to."
+1
> On Linux you can't assume any such resources except some apparently
> 1970s-style t
On 27/10/2016 11:07, Terry Reedy wrote:
On 10/26/2016 9:12 PM, BartC wrote:
On 27/10/2016 00:30, Terry Reedy wrote:
So how does your tkinter example work in such a server?
Without X-windows available, there would be no point, and it will not
work. I presume including the X window subsystem
On 10/27/2016 12:22 PM, pozz wrote:
Anyway I don't like this approach, because the main (and single) thread
should check in_waiting every X milliseconds.
If X is too high, I could wait for the answer even if it is already
ready in the input buffer.
If X is too low, the application consumes a lot
On Thu, Oct 27, 2016 at 10:33 PM, jmp wrote:
> On 10/27/2016 12:22 PM, pozz wrote:
>>
>> Anyway I don't like this approach, because the main (and single) thread
>> should check in_waiting every X milliseconds.
>> If X is too high, I could wait for the answer even if it is already
>> ready in the i
On Thu, 27 Oct 2016 09:42 pm, BartC wrote:
> On 27/10/2016 07:51, Steven D'Aprano wrote:
>> On Thursday 27 October 2016 12:12, BartC wrote:
>>
>>> I don't
>>> understand the argument that a language shouldn't have a basic keyboard
>>> API because some computers it could run on might not have a key
Il 27/10/2016 13:33, jmp ha scritto:
On 10/27/2016 12:22 PM, pozz wrote:
Anyway I don't like this approach, because the main (and single) thread
should check in_waiting every X milliseconds.
If X is too high, I could wait for the answer even if it is already
ready in the input buffer.
If X is to
On Thu, Oct 27, 2016 at 10:56 PM, pozz wrote:
> Yes of course, but when the backend thread calls the *blocking* function
> pyserial.read(), it *doesn't* consume CPU clocks (at least, I hope).
> The low-level implementation of pyserial.read() should move the thread in a
> "suspend" or "waiting" sta
On 10/27/2016 01:43 PM, Chris Angelico wrote:
Blocked threads don't consume CPU time. Why would they?
ChrisA
Agreed. My point being that a blocked thread achieve nothing, except
parallelism, i.e. other threads can be processed.
To be more specific, if you compute factorial(51354) in a thre
On Thu, Oct 27, 2016 at 11:33 PM, jmp wrote:
> On 10/27/2016 01:43 PM, Chris Angelico wrote:
>>
>> Blocked threads don't consume CPU time. Why would they?
>>
>> ChrisA
>>
>
> Agreed. My point being that a blocked thread achieve nothing, except
> parallelism, i.e. other threads can be processed.
>
[repost as original disappeared]
On 27/10/2016 12:41, Steve D'Aprano wrote:
On Thu, 27 Oct 2016 09:42 pm, BartC wrote:
I don't need one character at a time. I want to pause everything else, ask
the user a question, and wait for them to enter an entire line.
And no, I don't want to reinvent th
On 10/27/2016 02:55 PM, Chris Angelico wrote:
On Thu, Oct 27, 2016 at 11:33 PM, jmp wrote:
On 10/27/2016 01:43 PM, Chris Angelico wrote:
Blocked threads don't consume CPU time. Why would they?
ChrisA
Agreed. My point being that a blocked thread achieve nothing, except
parallelism, i.e. ot
BartC :
> If you're executing a billion instructions per second you don't want
> to keep stopping every N instructions to ask the user for any special
> requests, or to press Enter to continue.
In mobile computing, such wakeups drain the battery.
Marko
--
https://mail.python.org/mailman/listinf
On 2016-10-27, Marko Rauhamaa wrote:
> Grant Edwards :
>> I've offered a few times to extend the Linux pty driver to support the
>> same set of ioctl calls that a tty does (so that it could be used in
>> place of a tty generally), but I've never gotten any response.
>
> Ah, Linux kernel politics a
On 2016-10-27, Terry Reedy wrote:
> When I used unix in the 1980s, the full screen ran csh until one started
> another full screen application. MSDOS was the same. Every contemporary
> photo of modern Linux or Mac I have seen has a desktop with windows just
> like Windows. Do people on Linux
On 2016-10-27 07:33 AM, jmp wrote:
On 10/27/2016 12:22 PM, pozz wrote:
(blocking) thread. The blocking function read returns *immediately* when
all the bytes are received. And I think during blocking time, the
thread isn't consuming CPU clocks.
Threads do consume CPU clocks.
Sometimes they
Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10. Under
C:\Python35
C:\Python27
Both have been set in environment variable Path.
When I type python in cmd, it only gives me python 2.7, I am wondering how
to switch between 2 and 3 in command prompt.
cheers
--
https://mail.py
On Wednesday, October 26, 2016 at 5:31:18 PM UTC-5, MRAB wrote:
> On 2016-10-26 21:44, pic8...@gmail.com wrote:
> > On Monday, October 24, 2016 at 12:39:47 PM UTC-5, Thomas Nyberg wrote:
> >> On 10/24/2016 12:45 PM, pic8...@gmail.com wrote:
> >> > Thanks for the reply.
> >> >
> >> > The code snippe
Daiyue Weng wrote:
> Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10. Under
>
> C:\Python35
>
> C:\Python27
>
> Both have been set in environment variable Path.
>
> When I type python in cmd, it only gives me python 2.7, I am wondering how
> to switch between 2 and 3 in com
Daiyue Weng wrote:
> Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10.
> Under
>
> C:\Python35
>
> C:\Python27
>
> Both have been set in environment variable Path.
>
> When I type python in cmd, it only gives me python 2.7, I am wondering
> how to switch between 2 and 3 in c
On Fri, 28 Oct 2016 02:11 am, Daiyue Weng wrote:
> Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10. Under
>
> C:\Python35
>
> C:\Python27
>
> Both have been set in environment variable Path.
>
> When I type python in cmd, it only gives me python 2.7, I am wondering how
> to
On Thu, Oct 27, 2016 at 10:11 AM, Daiyue Weng wrote:
> Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10. Under
>
> C:\Python35
>
> C:\Python27
>
> Both have been set in environment variable Path.
>
> When I type python in cmd, it only gives me python 2.7, I am wondering how
> to
Rustom Mody wrote:
> On Saturday, July 2, 2016 at 9:17:01 AM UTC+5:30, Veek. M wrote:
>> object is a keyword and you're using it as an identifier
>
> keyword and builtin are different
> In this case though the advice remains the same
> In general maybe not...
> Just sayin'
np - feel free to corre
Ben Finney wrote:
> "Veek. M" writes:
>
>> class Foo(object):
>> pass
>>
>> object is a keyword and you're using it as an identifier
>
> Python does not have ‘object’ as a keyword. ‘and’ is a keyword.
>
> Here's the difference::
>
> >>> object
>
> >>> object = "Lorem ipsum"
>
On Fri, 28 Oct 2016 12:13 am, BartC wrote:
> [repost as original disappeared]
> On 27/10/2016 12:41, Steve D'Aprano wrote:
>> On Thu, 27 Oct 2016 09:42 pm, BartC wrote:
>
>> I don't need one character at a time. I want to pause everything else,
>> ask the user a question, and wait for them to ent
python windows launcher seems like the best option here.
thanks
On 27 October 2016 at 16:49, Zachary Ware
wrote:
> On Thu, Oct 27, 2016 at 10:11 AM, Daiyue Weng
> wrote:
> > Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10.
> Under
> >
> > C:\Python35
> >
> > C:\Python27
> >
Hello, i have a PyQT systray app with a menu and two actions.
Action1 is Exit and action2 display a MessageBox with Hello World message.
When i click OK to MessageBox app quits...why?
http://pastebin.com/bVA49k1C
--
https://mail.python.org/mailman/listinfo/python-list
On 27/10/2016 17:13, Steve D'Aprano wrote:
On Fri, 28 Oct 2016 12:13 am, BartC wrote:
Doubtless your solution would be some large sledgehammer to crack this
particular nut.
*shrug*
Python's a pretty high-level language. Not every low-level feature needs to
be part of the Python language. Th
On Thu, Oct 27, 2016 at 3:41 PM, Steve D'Aprano
wrote:
> On Fri, 28 Oct 2016 02:11 am, Daiyue Weng wrote:
>
>> Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10. Under
>>
>> C:\Python35
>>
>> C:\Python27
>>
>> Both have been set in environment variable Path.
>>
>> When I type pyt
I want to execute the command "gksudo umount VirtualDVD"
My code is this but it fails:
def umount(self):
'''unmounts VirtualDVD''' cmd ='gksudo umount VirtualDVD' proc =
subprocess.Popen(str(cmd),shell=True,stdout=subprocess.PIPE).stdout.read()
print proc
It pops up the gksudo dialog,
BartC wrote:
"There's a room in your house with no door to it; how do I get in?"
"There's no need for a door because no one ever uses that room! But you
can get in through the chimney - if you /have/ to."
It's not like that. The room *does* have a door, it's just
that it's in different places
On Thu, Oct 27, 2016 at 3:30 PM, Demosthenes Koptsis
wrote:
> I want to execute the command "gksudo umount VirtualDVD"
>
> My code is this but it fails:
>
> def umount(self):
> '''unmounts VirtualDVD''' cmd ='gksudo umount VirtualDVD' proc =
> subprocess.Popen(str(cmd),shell=True,stdout=subpro
On 27/10/2016 19:09, BartC wrote:
On 27/10/2016 17:13, Steve D'Aprano wrote:
On Fri, 28 Oct 2016 12:13 am, BartC wrote:
print "Enter 3 numbers: "
readln a,b,c
How is the interpreter supposed to know that a, b, c are numbers? What
sort
of numbers? 16-bit integers, 80-bit floats, Bignum
On Fri, Oct 28, 2016 at 9:02 AM, BartC wrote:
>
> I notice that when it comes to reading command-line arguments, then Python's
> sys.argv presents them as a list, not one long string.
>
> And the list is just a series of strings, so needing to know whether any
> parameter was a number or whatever
I just downloaded Python 3.5.2 for Windows, which I installed on a Windows 7
laptop. Disclaimer up front, I am a former lapsed programmer that has been
away from it and all things Windows since Windows XP. :)I’m back to being
a bit of a newbie again.
It’s a relatively clean laptop, just
On 27/10/2016 23:31, Chris Angelico wrote:
On Fri, Oct 28, 2016 at 9:02 AM, BartC wrote:
I notice that when it comes to reading command-line arguments, then Python's
sys.argv presents them as a list, not one long string.
And the list is just a series of strings, so needing to know whether any
On Thu, Oct 27, 2016 at 10:10 PM, Karen Hermann wrote:
>
> Can you help please, is there something wrong with my system / setup, should
> I be
> downloading a different Python version?
The system is missing the new C runtime. Enable Windows Update and
install the recommended updates.
--
https:/
On Fri, Oct 28, 2016 at 10:45 AM, BartC wrote:
> On 27/10/2016 23:31, Chris Angelico wrote:
>>
>> When
>> you exec to a process, you provide multiple arguments, not a single
>> combined string.
>
>
> Really, there could be dozens of arguments? Windows' CreateProcess() (if
> that's the same thing)
On 28/10/2016 01:08, Chris Angelico wrote:
On Fri, Oct 28, 2016 at 10:45 AM, BartC wrote:
On 27/10/2016 23:31, Chris Angelico wrote:
When
you exec to a process, you provide multiple arguments, not a single
combined string.
Really, there could be dozens of arguments? Windows' CreateProcess(
On 10/27/2016 04:07 AM, Terry Reedy wrote:
> As I and others have said, those keyboard functions are not available on
> text terminals. I predict that keyboard functions that so not work on
> all systems will never become built-ins. But some are available with an
> import.
Sure you can't get
On 10/27/2016 11:05 PM, Michael Torrie wrote:
> On 10/27/2016 04:07 AM, Terry Reedy wrote:
>> As I and others have said, those keyboard functions are not available on
>> text terminals. I predict that keyboard functions that so not work on
>> all systems will never become built-ins. But some ar
Am 28.10.16 um 07:05 schrieb Michael Torrie:
On 10/27/2016 04:07 AM, Terry Reedy wrote:
As I and others have said, those keyboard functions are not available on
text terminals. I predict that keyboard functions that so not work on
all systems will never become built-ins. But some are available
54 matches
Mail list logo