Re: async watch directory for new files

2021-04-24 Thread Zoran
> Bear in mind that asyncio is NOT the only way to be asynchronous. So 
> what you're asking for is, very specifically, an asyncio-compatible 
> inotify. Turns out, there's an ainotify on PyPI that might be what you 
> want. 

Yes there is:
https://github.com/rbarrois/aionotify
https://asyncinotify.readthedocs.io/en/latest/
https://pypi.org/project/aionotify/
https://pypi.org/project/butter/
https://github.com/giannitedesco/minotaur
https://pypi.org/project/watchgod/
...

There are many of them.
I hoped that someone with experience here can suggest a library that he has 
been used on some project.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: async watch directory for new files

2021-04-24 Thread Chris Angelico
On Sun, Apr 25, 2021 at 6:16 AM Zoran  wrote:
>
> On Saturday, 24 April 2021 at 18:52:24 UTC+2, Dieter Maurer wrote:
> > Zoran wrote at 2021-4-23 14:31 -0700:
> > >I need to watch for new files in directory, and when it shows up, I should 
> > >create async task with file's full path for it, and wait for new file.
> > >
> > >If anyone here used a library for such task, please share which one.
> > The solution likely depends on the OS you are using.
> >
> > For Linux, `inotify` informs applications about file system changes.
> > PyPI contains a binding for it -- with identical name.
>
> As I can see https://pypi.org/project/inotify/ is not asyncio frendly.
> Whatever I use, it should be asynchronous.
> Final OS is linux (Centos 7), but I am doing development on Windows 10 
> machine, so it would be nice if I have something that works on both.

Bear in mind that asyncio is NOT the only way to be asynchronous. So
what you're asking for is, very specifically, an asyncio-compatible
inotify. Turns out, there's an ainotify on PyPI that might be what you
want.

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


Re: "py.ini" question

2021-04-24 Thread Chris Angelico
On Sun, Apr 25, 2021 at 5:57 AM Gisle Vanem  wrote:
>
> With 'py -3.6' or 'py 3.8' I get the expected.
> But with 'py -3':
>Python 3.8.9 (default, Apr 13 2021, 15:54:59)  [GCC 10.2.0 64 bit (AMD64)] 
> on win32
>
I believe that's because you're asking for "the latest in the 3.x series".

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


Re: async watch directory for new files

2021-04-24 Thread Zoran
On Saturday, 24 April 2021 at 18:52:24 UTC+2, Dieter Maurer wrote:
> Zoran wrote at 2021-4-23 14:31 -0700: 
> >I need to watch for new files in directory, and when it shows up, I should 
> >create async task with file's full path for it, and wait for new file. 
> > 
> >If anyone here used a library for such task, please share which one.
> The solution likely depends on the OS you are using. 
> 
> For Linux, `inotify` informs applications about file system changes. 
> PyPI contains a binding for it -- with identical name.

As I can see https://pypi.org/project/inotify/ is not asyncio frendly.
Whatever I use, it should be asynchronous. 
Final OS is linux (Centos 7), but I am doing development on Windows 10 machine, 
so it would be nice if I have something that works on both.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: "py.ini" question

2021-04-24 Thread Gisle Vanem

Barry Scott wrote:


A copy of this is also in 'c:\Windows\py.ini'.
So when I do a:
  py -3 -c "import sys; print(sys.version)"

I would assume a "3.6..." would be printed.
But no, py.exe chooses to run my newest Python 3.8:
  3.8.9 (default, Apr 13 2021, 15:54:59)  [GCC 10.2.0 64 bit (AMD64)]

Only when I do 'py -3.6 -c ...', I get what I'd expect.

So is a 'py.ini' and the '[defaults]' simply ignored
or is my syntax wrong?



On windows 10 your personal py.ini is in %localappdata%\py.ini
do you have one?


Yes, that's my 'c:\Users\Gisle\AppData\Local\py.ini'
in my case.


C:\Users\barry>py -0
Installed Pythons found by py Launcher for Windows
  -3.10-64
  -3.10-32
  -3.9-64 *
  -3.9-32
  -3.8-64
  -3.8-32
  -3.7-64
  -3.7-32
  -3.6-64
  -3.6-32
  -3.5-64
  -3.5-32
  -3.4-64
  -3.4-32
  -2.7-64
  -2.7-32


On that, I'm getting:
  Requested Python version (0) not installed

Is that '-0' some 3.9+ feature?


C:\Users\barry>py
Python 3.9.4 (tags/v3.9.4:1f2e308, Apr  6 2021, 13:40:21) [MSC v.1928 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

With a 'py', I get:
  Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit 
(Intel)] on win32

With 'py -3.6' or 'py 3.8' I get the expected.
But with 'py -3':
  Python 3.8.9 (default, Apr 13 2021, 15:54:59)  [GCC 10.2.0 64 bit (AMD64)] on 
win32

Since I'm on a 64-bit Python, a 'py -3' totally seems to ignore
'py.ini', unless it says:
  [defaults]
  python3=3.6
  python3=3.6-32

Strange as always.

And yes, Mats Wichmann, I've tried a 'set PYLAUNCH_DEBUG=1'.
No help.

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


Re: "py.ini" question

2021-04-24 Thread Barry Scott



> On 24 Apr 2021, at 15:23, Gisle Vanem  wrote:
> 
> I have a question about the Python launcher;
>  c:\Windows\py.exe and the py.ini file.
> 
> I have both Python 3.6 (32-bit) and Python 3.8 (64-bit)
> installed. And I have a 'c:\Users\Gisle\AppData\Local\py.ini'
> with this only:
>  [defaults]
>  python=3.6
> 
> A copy of this is also in 'c:\Windows\py.ini'.
> So when I do a:
>  py -3 -c "import sys; print(sys.version)"
> 
> I would assume a "3.6..." would be printed.
> But no, py.exe chooses to run my newest Python 3.8:
>  3.8.9 (default, Apr 13 2021, 15:54:59)  [GCC 10.2.0 64 bit (AMD64)]
> 
> Only when I do 'py -3.6 -c ...', I get what I'd expect.
> 
> So is a 'py.ini' and the '[defaults]' simply ignored
> or is my syntax wrong?

You can find out what py.exe is using for its config by running:

py -0

The entry with an * at the end is the default.

On windows 10 your personal py.ini is in %localappdata%\py.ini
do you have one?

type %localappdata%\py.ini

If not you might want to create one that sets things up as you need them 
configured.

Here is what I have on my windows 10:

C:\Users\barry>py -0
Installed Pythons found by py Launcher for Windows
 -3.10-64
 -3.10-32
 -3.9-64 *
 -3.9-32
 -3.8-64
 -3.8-32
 -3.7-64
 -3.7-32
 -3.6-64
 -3.6-32
 -3.5-64
 -3.5-32
 -3.4-64
 -3.4-32
 -2.7-64
 -2.7-32


C:\Users\barry>type %localappdata%\py.ini
[defaults]
python=3.9-64
python3=3.9-64

C:\Users\barry>py
Python 3.9.4 (tags/v3.9.4:1f2e308, Apr  6 2021, 13:40:21) [MSC v.1928 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

Barry


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

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


Re: Ad-hoc SQL query builder for Python3?

2021-04-24 Thread dn via Python-list
On 25/04/2021 02.24, Rich Shepard wrote:
> My web searches are not finding what I need to include in an application
> I'm
> building: an ad-hoc sql query builder.
> 
> End users will want to query their data for reports not included in the
> built-in queries. My searches find a windows-only tool that apparently
> costs
> developers for the version to include in their applications. I'm looking
> for
> a F/OSS tool and I'm sure these are available somewhere.
> 
> Suggestions are needed.

Which RDBMS?

MySQL Workbench
Oracle Application Builder(s)
Sundry tools built on PHP

- for varying definitions of F/LOSS and 'ad-hoc'!
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: async watch directory for new files

2021-04-24 Thread Dieter Maurer
Zoran wrote at 2021-4-23 14:31 -0700:
>I need to watch for new files in directory, and when it shows up, I should 
>create async task with file's full path for it, and wait for new file.
>
>If anyone here used a library for such task, please share which one.

The solution likely depends on the OS you are using.

For Linux, `inotify` informs applications about file system changes.
PyPI contains a binding for it -- with identical name.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ad-hoc SQL query builder for Python3?

2021-04-24 Thread Rich Shepard

On Sat, 24 Apr 2021, J. Pic wrote:


Maybe search or ask dba stackexchange for more, meanwhile, here's a
popular one: https://github.com/dbeaver/dbeaver


J.,

I use dbeaver-ce now and then as an admin tool. I didn't consider it as an
included component in a desktop application. I'll look at it from that
perspective.

Thanks,

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


Re: Ad-hoc SQL query builder for Python3?

2021-04-24 Thread J. Pic
Maybe search or ask dba stackexchange for more, meanwhile, here's a popular
one: https://github.com/dbeaver/dbeaver
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: "py.ini" question

2021-04-24 Thread Mats Wichmann

On 4/24/21 8:23 AM, Gisle Vanem wrote:

I have a question about the Python launcher;
   c:\Windows\py.exe and the py.ini file.

I have both Python 3.6 (32-bit) and Python 3.8 (64-bit)
installed. And I have a 'c:\Users\Gisle\AppData\Local\py.ini'
with this only:
   [defaults]
   python=3.6

A copy of this is also in 'c:\Windows\py.ini'.
So when I do a:
   py -3 -c "import sys; print(sys.version)"

I would assume a "3.6..." would be printed.
But no, py.exe chooses to run my newest Python 3.8:
   3.8.9 (default, Apr 13 2021, 15:54:59)  [GCC 10.2.0 64 bit (AMD64)]

Only when I do 'py -3.6 -c ...', I get what I'd expect.

So is a 'py.ini' and the '[defaults]' simply ignored
or is my syntax wrong?



You could try this:

"If an environment variable PYLAUNCH_DEBUG is set (to any value), the 
launcher will print diagnostic information to stderr (i.e. to the 
console). While this information manages to be simultaneously verbose 
and terse, it should allow you to see what versions of Python were 
located, why a particular version was chosen and the exact command-line 
used to execute the target Python."


and see what it teaches you...

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


Ad-hoc SQL query builder for Python3?

2021-04-24 Thread Rich Shepard

My web searches are not finding what I need to include in an application I'm
building: an ad-hoc sql query builder.

End users will want to query their data for reports not included in the
built-in queries. My searches find a windows-only tool that apparently costs
developers for the version to include in their applications. I'm looking for
a F/OSS tool and I'm sure these are available somewhere.

Suggestions are needed.

TIA,

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


"py.ini" question

2021-04-24 Thread Gisle Vanem

I have a question about the Python launcher;
  c:\Windows\py.exe and the py.ini file.

I have both Python 3.6 (32-bit) and Python 3.8 (64-bit)
installed. And I have a 'c:\Users\Gisle\AppData\Local\py.ini'
with this only:
  [defaults]
  python=3.6

A copy of this is also in 'c:\Windows\py.ini'.
So when I do a:
  py -3 -c "import sys; print(sys.version)"

I would assume a "3.6..." would be printed.
But no, py.exe chooses to run my newest Python 3.8:
  3.8.9 (default, Apr 13 2021, 15:54:59)  [GCC 10.2.0 64 bit (AMD64)]

Only when I do 'py -3.6 -c ...', I get what I'd expect.

So is a 'py.ini' and the '[defaults]' simply ignored
or is my syntax wrong?

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


Re: async watch directory for new files

2021-04-24 Thread Gene Heskett
On Friday 23 April 2021 17:31:40 Zoran wrote:

> Hi,
>
> I need to watch for new files in directory, and when it shows up, I
> should create async task with file's full path for it, and wait for
> new file.
>
> If anyone here used a library for such task, please share which one.
>
> Regards.

inotifywait contains several variations of a notifier, I use it rather 
heavly here to automate such goings on as my incoming e-mail.

The variation I use most is launched by a bash script, when then waits 
for its return with the name of the new file, that bash script then 
takes an action determined by the name that was returned.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple question - end a raw string with a single backslash ?

2021-04-24 Thread Peter J. Holzer
On 2020-10-19 06:24:18 -, Mladen Gogala via Python-list wrote:
> On Mon, 19 Oct 2020 02:44:25 +, Stefan Ram wrote:
> > Mladen Gogala  writes:
> >>In Perl, there are no classes. 
> > 
> >   If there are no classes in Perl, then what does
> > 
> > bless REF,CLASSNAME 
> > 
> >   do?
> 
> bless \$ref will make the given reference a reference to the class. And 
> classes is Perl
> are called "modules". However, Perl classes are not the classes in the  real 
> sense. There 
> is no inheritance.

That's wrong. Perl classes have inheritance, and they always have had it
since they were introduced in Perl 5.0 (in 1994).


> You can have a similar thing in C: it's called "struct", it can do
> similar things like Perl modules.

Nope. C structs are data structures. Perl modules are primarily a way to
structure code.


> But C isn't object oriented. Inheritance is an essential
> characteristic of object orientation.

You can have that even in C. One of my first major C programs (back in
the 1980s) was object-oriented (including inheritance). I didn't even
know what "object oriented" meant back then, but the library we used for
the GUI stuff used that style so it felt natural to extend it to
"application level" objects.

> There were attempts to turn Perl into OO language with Moose
> (https://metacpan.org/pod/Moose)

Moose just adds syntactic sugar. It may be easier to read (especially
for people used to other OO languages) and save a bit of typing, but it
doesn't add anything you couldn't do in plain Perl5.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list