[Python-announce] RsFile 3.0 released

2022-06-27 Thread Pascal Chambon

Dear pythoneers,

I'm pleased to announce version 3.0 of RSFile I/O Library, which adds 
support for python 3.8, 3.9, and 3.10, drops support for Python<=3.5, 
and strengthens testing on OSX.


RSFile provides cross-platform drop-in replacements for the classes of 
the io module, and for the open() builtin.


Its goal is to provide a cross-platform, reliable, and comprehensive 
synchronous file I/O API, with advanced features like fine-grained 
opening modes, shared/exclusive file record locking, thread-safety, disk 
cache synchronization, file descriptor inheritability, and handy stat 
getters (size, inode, times…).


Locking is performed using actual file record locking capabilities of 
the OS, not by using separate files/directories as locking markers, or 
other fragile gimmicks. Unix users might particularly be interested by 
the workaround that this library provides, concerning the weird semantic 
of fcntl() locks (when any descriptor to a disk file is closed, the 
process loses ALL locks acquired on this file through any descriptor). 
Possible use cases for this library: concurrently writing to logs 
without ending up with garbled data, manipulating sensitive data like 
disk-based databases, synchronizing heterogeneous producer/consumer 
processes when multiprocessing semaphores aren’t an option…


https://pypi.org/project/RSFile/
https://rsfile.readthedocs.io/en/latest/
https://github.com/pakal/rsfile/

regards,

Pakal

___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


Re: [bottlepy/bottle] How to modify server adapters? (Issue #1385)

2022-06-27 Thread נתי שטרן
I sent this to mailing list

בתאריך יום שני, 27 ביוני 2022, מאת Marcel Hellkamp :

> Then ask specific questions. Also, this is an issue tracker, not a support
> forum. Try the mailing-list.
>
> —
> Reply to this email directly, view it on GitHub
> ,
> or unsubscribe
> 
> .
> You are receiving this because you authored the thread.Message ID:
> 
>


-- 

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


Bottle server adepter - how to modify ?

2022-06-27 Thread נתי שטרן
Tnx

-- 

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


Re: Logging into single file from multiple modules in python when TimedRotatingFileHandler is used

2022-06-27 Thread Peter J. Holzer
On 2022-06-21 02:04:52 -0700, Chethan Kumar S wrote:
> I have a main process which makes use of different other modules. And
> these modules also use other modules. I need to log all the logs into
> single log file. Due to use of TimedRotatingFileHandler, my log
> behaves differently after midnight. I got to know why it is so but
> couldn't get how I can solve it.
> Issue was because of serialization in logging when multiple processes
 ^^
> are involved.

I think this is crucial point. Not "multiple modules" (as you wrote in
the subject), but "multiple processes". If each of multiple processes
wants to rotate the logfile itself, it is very likely that they will
work at cross-purposes.

Somebody already suggested using logrotate (or similar external tools).
You can then use WatchedFileHandler
(https://docs.python.org/3/library/logging.handlers.html#watchedfilehandler)
to automatically detect when a logile has been rotated.

Alternatively you can use a central logging service (like syslog) which
handles all that stuff.

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


Re: Subtract n months from datetime

2022-06-27 Thread Peter J. Holzer
On 2022-06-21 05:29:52 +0100, Paulo da Silva wrote:
> I implemented a part of a script to subtract n months from datetime.
> Basically I subtracted n%12 from year and n//12 from the month adding 12
> months when it goes<=0. Then used try when converting to datetime again. So,
> if the day is for example 31 for a 30 days month it raises a ValuError
> exception. Then I subtract 1 to day and repeat.

For a recent longish discussion of that matter see the threads starting
at https://mail.python.org/pipermail/python-list/2022-April/905985.html
and https://mail.python.org/pipermail/python-list/2022-April/906045.html
(the latter also contains some prototype code).

(I apologize for not pursuing that further at the time. I wanted to
bolster that case with some real world applications, but I was a bit
swamped with Real Work™ and didn't find anything suitable.)

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


Re: [bottlepy/bottle] How to modify server adapters? (Issue #1385)

2022-06-27 Thread נתי שטרן
I looked on code but I still need help on this topic
I also need help with wsgiref

בתאריך יום שני, 27 ביוני 2022, מאת Marcel Hellkamp :

> Bottle is just a single file and server adapters are often just a couple
> of lines long. "Look at the code" is often the best advice. You so do not
> need server adapters to run a server. Bottle apps are WSGI apps. Just
> follow the documentation of the WSGI server you want to use.
>
> —
> Reply to this email directly, view it on GitHub
> ,
> or unsubscribe
> 
> .
> You are receiving this because you authored the thread.Message ID:
> 
>


-- 

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


Re: REPL with multiple function definitions

2022-06-27 Thread Jon Ribbens via Python-list
On 2022-06-26, Rob Cliffe  wrote:
> This 2-line program
>
> def f(): pass
> def g(): pass
>
> runs silently (no Exception).  But:
>
> 23:07:02 c:\>python
> Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> def f(): pass
> ... def g(): pass
>    File "", line 2
>      def g(): pass
>      ^
> SyntaxError: invalid syntax
> >>>
>
> Is there a good reason for this?

For some reason, the REPL can't cope with one-line blocks like that.
If you put a blank line after each one-block line then it will work.
-- 
https://mail.python.org/mailman/listinfo/python-list