Re: Why Python has no equivalent of JDBC of Java?

2019-05-26 Thread Bischoop
On 2019-05-19, Marco Sulla  wrote:
>blablabla
>blablablalbla
>blablalblalbalblabla

There's no perfect language mate, in some one is easier in other not,
normal surprised you notice it so late.



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Implementing C++'s getch() in Python

2019-05-26 Thread binoythomas1108
I've run getpass() on IDLE, Spyder, PyCharm and Mu. All with negative results.



-- 
https://mail.python.org/mailman/listinfo/python-list


How to use ssh-agent in windows in python?

2019-05-26 Thread Fc Zwtyds

Hi,
  I am using cygwin on Windows 8.1. These two commands work fine in cygwin:
ssh-agent -s
ssh-add ~/.ssh /id_rsa
  I tried to use them on windows cmd and it worked fine. Now I am going 
to use python to write code to implement the above command.

os.system('ssh-agent -s')
os.system('ssh-add id_rsa')
There was an error:
Could not open a connection to your authentication agent.

Thank you and your time.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Implementing C++'s getch() in Python

2019-05-26 Thread Shakti Kumar
On Sun, 26 May 2019 at 20:23,  wrote:
>
> I've run getpass() on IDLE, Spyder, PyCharm and Mu. All with negative results.
>
>
As Random832 pointed out, these IDEs cannot handle the stdout/stdin with getpass
You should use a normal terminal (command prompt) on your windows for
running this program.

You can read more here, https://docs.python.org/3.1/library/getpass.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Implementing C++'s getch() in Python

2019-05-26 Thread eryk sun
On 5/25/19, Paul Moore  wrote:
>
> On Windows, the msvcrt module exposes getch:
> https://docs.python.org/3.7/library/msvcrt.html#msvcrt.getch

I suggest using msvcrt.getwch instead of msvcrt.getch. Both functions
are limited to the basic multilingual plane (BMP, i.e. U+ --
U+), but getch is additionally limited to the console input
codepage. In Windows, getpass.getpass is based on msvcrt.getwch and
msvcrt.putwch.

If you use getch and need the full BMP range, you can temporarily
change the console input codepage to UTF-8 (65001). It's a multibyte
encoding (i.e. 1-3 bytes per BMP code), so the initial getch call has
to be followed by a loop that calls it again while the sequence can't
be decoded and kbhit() is true.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to use ssh-agent in windows in python?

2019-05-26 Thread MRAB

On 2019-05-26 15:55, Fc Zwtyds wrote:

Hi,
I am using cygwin on Windows 8.1. These two commands work fine in cygwin:
ssh-agent -s
ssh-add ~/.ssh /id_rsa
I tried to use them on windows cmd and it worked fine. Now I am going
to use python to write code to implement the above command.
os.system('ssh-agent -s')
os.system('ssh-add id_rsa')
There was an error:
Could not open a connection to your authentication agent.

Thank you and your time.

The string that you passed to the second os.system differs from the 
second command on the command line. Is that the cause?

--
https://mail.python.org/mailman/listinfo/python-list


Re: Why Python has no equivalent of JDBC of Java?

2019-05-26 Thread Christian Gollwitzer

Am 21.05.19 um 14:27 schrieb Adriaan Renting:

Java was meant to be generic, run anywhere and abstract and hide
differences in its underlying infrastructure. This has led to the Java
VM, and also JDBC I guess.

Python was more of a script interpreted C-derivative, much closer to
the bare metal, and thus much less effort was made to hide and
abstract.


Python closer to the metal than Java? This is nonsense. It is exactly 
the opposite. As a simple empirical proof, there are compilers which 
compile Java to native code (gcj) with comparable performance than C 
code, while such a thing is almost not doable for Python, only for 
restricted subsets. Java code can be "manually compiled" into C++ code 
with only a few tweaks, most notably you need a garbage collector, but 
that's it - apart from a huge library, maybe.
Python code with dynamic typing cannot be statically compiled in the 
same way, which you pay for by a factor of 100 in execution speed.


Christian
--
https://mail.python.org/mailman/listinfo/python-list


Re: More CPUs doen't equal more speed

2019-05-26 Thread Grant Edwards
On 2019-05-23, Chris Angelico  wrote:
> On Fri, May 24, 2019 at 5:37 AM Bob van der Poel  wrote:
>>
>> I've got a short script that loops though a number of files and
>> processes them one at a time. I had a bit of time today and figured
>> I'd rewrite the script to process the files 4 at a time by using 4
>> different instances of python. My basic loop is:
>>
>> for i in range(0, len(filelist), CPU_COUNT):
>> for z in range(i, i+CPU_COUNT):
>> doit( filelist[z])
>>
>> With the function doit() calling up the program to do the
>> lifting. Setting CPU_COUNT to 1 or 5 (I have 6 cores) makes no
>> difference in total speed.  I'm processing about 1200 files and my
>> total duration is around 2 minutes.  No matter how many cores I use
>> the total is within a 5 second range.
>
> Where's the part of the code that actually runs them across multiple
> CPUs? Also, are you spending your time waiting on the disk, the CPU,
> IPC, or something else?

He said he's using N differenct Python instances, and he even provided
the code that runs in each instance which is obviously processesing
1/Nth of the files.

It's a pretty good bet that I/O is the limiting factor.

--
Grant




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: More CPUs doen't equal more speed

2019-05-26 Thread Chris Angelico
On Mon, May 27, 2019 at 4:06 AM Grant Edwards  wrote:
>
> On 2019-05-23, Chris Angelico  wrote:
> > On Fri, May 24, 2019 at 5:37 AM Bob van der Poel  wrote:
> >>
> >> I've got a short script that loops though a number of files and
> >> processes them one at a time. I had a bit of time today and figured
> >> I'd rewrite the script to process the files 4 at a time by using 4
> >> different instances of python. My basic loop is:
> >>
> >> for i in range(0, len(filelist), CPU_COUNT):
> >> for z in range(i, i+CPU_COUNT):
> >> doit( filelist[z])
> >>
> >> With the function doit() calling up the program to do the
> >> lifting. Setting CPU_COUNT to 1 or 5 (I have 6 cores) makes no
> >> difference in total speed.  I'm processing about 1200 files and my
> >> total duration is around 2 minutes.  No matter how many cores I use
> >> the total is within a 5 second range.
> >
> > Where's the part of the code that actually runs them across multiple
> > CPUs? Also, are you spending your time waiting on the disk, the CPU,
> > IPC, or something else?
>
> He said he's using N differenct Python instances, and he even provided
> the code that runs in each instance which is obviously processesing
> 1/Nth of the files.
>
> It's a pretty good bet that I/O is the limiting factor.
>

Sometimes, the "simple" and "obvious" code, the part that clearly has
no bugs in it, is the part that has the problem. :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: More CPUs doen't equal more speed

2019-05-26 Thread Grant Edwards
On 2019-05-26, Chris Angelico  wrote:

> Sometimes, the "simple" and "obvious" code, the part that clearly has
> no bugs in it, is the part that has the problem. :)

And in this case, the critical part of the code that was actually
serializing everything wasn't shown.  One strives to post problem
descriptions that are as simple as possible, but in this case the
description was even simpler than that.

-- 
Grant



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: More CPUs doen't equal more speed

2019-05-26 Thread Chris Angelico
On Mon, May 27, 2019 at 4:24 AM Grant Edwards  wrote:
>
> On 2019-05-26, Chris Angelico  wrote:
>
> > Sometimes, the "simple" and "obvious" code, the part that clearly has
> > no bugs in it, is the part that has the problem. :)
>
> And in this case, the critical part of the code that was actually
> serializing everything wasn't shown.  One strives to post problem
> descriptions that are as simple as possible, but in this case the
> description was even simpler than that.
>

Indeed, which is why I asked the question.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: More CPUs doen't equal more speed

2019-05-26 Thread Bob van der Poel
On Sun, May 26, 2019 at 11:05 AM Grant Edwards 
wrote:

> On 2019-05-23, Chris Angelico  wrote:
> > On Fri, May 24, 2019 at 5:37 AM Bob van der Poel 
> wrote:
> >>
> >> I've got a short script that loops though a number of files and
> >> processes them one at a time. I had a bit of time today and figured
> >> I'd rewrite the script to process the files 4 at a time by using 4
> >> different instances of python. My basic loop is:
> >>
> >> for i in range(0, len(filelist), CPU_COUNT):
> >> for z in range(i, i+CPU_COUNT):
> >> doit( filelist[z])
> >>
> >> With the function doit() calling up the program to do the
> >> lifting. Setting CPU_COUNT to 1 or 5 (I have 6 cores) makes no
> >> difference in total speed.  I'm processing about 1200 files and my
> >> total duration is around 2 minutes.  No matter how many cores I use
> >> the total is within a 5 second range.
> >
> > Where's the part of the code that actually runs them across multiple
> > CPUs? Also, are you spending your time waiting on the disk, the CPU,
> > IPC, or something else?
>
> He said he's using N differenct Python instances, and he even provided
> the code that runs in each instance which is obviously processesing
> 1/Nth of the files.
>
> It's a pretty good bet that I/O is the limiting factor.
>
> I did say that ... I also retracted it. In my first eg. I was still
running one process at a time ... no multi-task at all. Parallel is up and
running and is very, very fast ... loads my CPUs to 100%

>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 

 Listen to my FREE CD at http://www.mellowood.ca/music/cedars 
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: b...@mellowood.ca
WWW:   http://www.mellowood.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to use ssh-agent in windows in python?

2019-05-26 Thread Cameron Simpson

On 26May2019 22:55, Fc Zwtyds  wrote:
 I am using cygwin on Windows 8.1. These two commands work fine in 
 cygwin:

ssh-agent -s
ssh-add ~/.ssh /id_rsa


No, they run without error (apparently). That is  an entirely different 
thing.


In particular, "ssh-agent -s" starts an agent but unless you make use of 
its output, your subsequent commands will have no idea how to access it.


Since ssh-add (apparently) works, then I would guess you _already_ had 
an agent, and it is adding to that agent's keys. And, importantly, 
_ignoring_ the new agent you started.


Try running your commands above again, but _before_ them, run "ssh-add 
-l". If that works then there's already an agent known to the shell and 
your subsequent "ssh-add" is likely adding to that, not to the new agent 
you dispatched.


 I tried to use them on windows cmd and it worked fine. Now I am 
going to use python to write code to implement the above command.

os.system('ssh-agent -s')
os.system('ssh-add id_rsa')
There was an error:
Could not open a connection to your authentication agent.


I'm presuming that as with UNIXy systems, os.system() on Windows issues 
its commands to a distinct shell ( instance of cmd.exe or the like).


As such, since you've made no effort to catch and parse the output of 
"ssh-agent -s" you don't know how to talk to the agent you started, and 
further since you don't pass any information to the shell running 
"ssh-add" then it doesn't know how to do that either.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to use ssh-agent in windows in python?

2019-05-26 Thread Fc Zwtyds

在 2019-05-27 0:27, MRAB 写道:

On 2019-05-26 15:55, Fc Zwtyds wrote:

Hi,
    I am using cygwin on Windows 8.1. These two commands work fine in 
cygwin:

ssh-agent -s
ssh-add ~/.ssh /id_rsa
    I tried to use them on windows cmd and it worked fine. Now I am going
to use python to write code to implement the above command.
os.system('ssh-agent -s')
os.system('ssh-add id_rsa')
There was an error:
Could not open a connection to your authentication agent.

Thank you and your time.

The string that you passed to the second os.system differs from the 
second command on the command line. Is that the cause?


Hi,
  At the beginning string is like this
ssh-add ~/.ssh/id_rsa
  In order to facilitate the test, multiple quick input, I copied 
id_rsa into the program directory, the string was changed to

ssh-add id_rsa
  Whether in cygwin or cmd, manually entering these two commands will 
execute correctly.


As far as I know, the problem seems to be that a subshell is opened 
after 'ssh-agent -s' execution, and I don't know how to use python to 
implement this process.


Thank you for your help
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to use ssh-agent in windows in python?

2019-05-26 Thread Fc Zwtyds

在 2019-05-27 7:13, Cameron Simpson 写道:

On 26May2019 22:55, Fc Zwtyds  wrote:
 I am using cygwin on Windows 8.1. These two commands work fine in 
 cygwin:

ssh-agent -s
ssh-add ~/.ssh /id_rsa


No, they run without error (apparently). That is  an entirely different 
thing.


In particular, "ssh-agent -s" starts an agent but unless you make use of 
its output, your subsequent commands will have no idea how to access it.


Since ssh-add (apparently) works, then I would guess you _already_ had 
an agent, and it is adding to that agent's keys. And, importantly, 
_ignoring_ the new agent you started.


Try running your commands above again, but _before_ them, run "ssh-add 
-l". If that works then there's already an agent known to the shell and 
your subsequent "ssh-add" is likely adding to that, not to the new agent 
you dispatched.


 I tried to use them on windows cmd and it worked fine. Now I am going 
to use python to write code to implement the above command.

os.system('ssh-agent -s')
os.system('ssh-add id_rsa')
There was an error:
Could not open a connection to your authentication agent.


I'm presuming that as with UNIXy systems, os.system() on Windows issues 
its commands to a distinct shell ( instance of cmd.exe or the like).


As such, since you've made no effort to catch and parse the output of 
"ssh-agent -s" you don't know how to talk to the agent you started, and 
further since you don't pass any information to the shell running 
"ssh-add" then it doesn't know how to do that either.


Cheers,
Cameron Simpson 


Thank you very much for your detailed answer.
I will try to learn how to capture and parse the output of "ssh-agent 
-s" and learn how to talk to the agent.


--
https://mail.python.org/mailman/listinfo/python-list


Re: How to use ssh-agent in windows in python?

2019-05-26 Thread Cameron Simpson

On 27May2019 08:22, Fc Zwtyds  wrote:

Thank you very much for your detailed answer.
I will try to learn how to capture and parse the output of "ssh-agent 
-s" and learn how to talk to the agent.


The output of "ssh-agent -s" is Bourne shell variable assignment syntax.  
You need to parse that and then install those values in so.environ 
before calling the second command. The subprocess module has methods for 
collecting the output of a command (see the communicate method).


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Undefined symbols for Mac OS 10.14.4 build

2019-05-26 Thread Mark Turner
Hi,

I’m trying to build CPython 3.8 from source on Mac OS 10.14.4 and running into 
undefined symbols problem at the linker stage.The commands I’m using are:

./configure --with-pydebug
make -s -j2

The undefined symbols are listed below.

I’ve found that if I modify pyconfig.h by changing
#define HAVE_LIBINTL_H 1
to
#undef HAVE_LIBINTL_H
the build completes.


This is my first time trying this so I’m not very familiar with the build 
process. It seems like I must be missing something since I don't think 
modifying pyconfig.h is a normal part of the process. Any suggestions?

Thanks,
Mark


Undefined symbols for architecture x86_64:
Undefined symbols for architecture x86_64:
  "_libintl_bindtextdomain", referenced from:
  "_libintl_bindtextdomain", referenced from:
  _PyIntl_bindtextdomain in libpython3.8d.a(_localemodule.o)
  _PyIntl_bindtextdomain in libpython3.8d.a(_localemodule.o)
  "_libintl_dcgettext", referenced from:
  "_libintl_dcgettext", referenced from:
  _PyIntl_dcgettext in libpython3.8d.a(_localemodule.o)
  _PyIntl_dcgettext in libpython3.8d.a(_localemodule.o)
  "_libintl_dgettext", referenced from:
  "_libintl_dgettext", referenced from:
  _PyIntl_dgettext in libpython3.8d.a(_localemodule.o)
  _PyIntl_dgettext in libpython3.8d.a(_localemodule.o)
  "_libintl_gettext", referenced from:
  "_libintl_gettext", referenced from:
  _PyIntl_gettext in libpython3.8d.a(_localemodule.o)
  _PyIntl_gettext in libpython3.8d.a(_localemodule.o)
  "_libintl_setlocale", referenced from:
  "_libintl_setlocale", referenced from:
  _PyLocale_setlocale in libpython3.8d.a(_localemodule.o)
  _PyLocale_setlocale in libpython3.8d.a(_localemodule.o)
  _locale_decode_monetary in libpython3.8d.a(_localemodule.o)
  _locale_decode_monetary in libpython3.8d.a(_localemodule.o)
  "_libintl_textdomain", referenced from:
  "_libintl_textdomain", referenced from:
  _PyIntl_textdomain in libpython3.8d.a(_localemodule.o)
  _PyIntl_textdomain in libpython3.8d.a(_localemodule.o)
ld: symbol(s) not found for architecture x86_64
ld: symbol(s) not found for architecture x86_64
-- 
https://mail.python.org/mailman/listinfo/python-list