Permission denied when opening a file that was created concurrently by os.rename (Windows)

2015-04-05 Thread Alexey Izbyshev
Hello! I've hit a strange problem that I reduced to the following test case: * Run several python processes in parallel that spin in the following loop: while True: if os.path.isfile(fname): with open(fname, 'rb') as f: f.read() break * Then, run another process that creates a t

Re: Permission denied when opening a file that was created concurrently by os.rename (Windows)

2015-04-05 Thread Chris Angelico
On Mon, Apr 6, 2015 at 3:45 AM, Alexey Izbyshev wrote: > The test case is attached, the main file is test.bat. Python is expected to > be in PATH. Stderr of readers is redirected to *.log. You may need to run > several times to hit the issue. You have an interesting-looking problem, but the attac

Re: Permission denied when opening a file that was created concurrently by os.rename (Windows)

2015-04-05 Thread Dave Angel
On 04/05/2015 01:45 PM, Alexey Izbyshev wrote: Hello! I've hit a strange problem that I reduced to the following test case: * Run several python processes in parallel that spin in the following loop: while True: if os.path.isfile(fname): with open(fname, 'rb') as f: f.read()

Help with pipes, buffering and pseudoterminals

2015-04-05 Thread Daniel Ellis
I have a small little tool I'd like to make. It essentially takes piped input, modifies the text in some way, and immediately prints the output. The problem I'm having is that any output I pipe to the program seems to be buffered, removing the desired effect. >From what I understand, I need t

Re: Permission denied when opening a file that was created concurrently by os.rename (Windows)

2015-04-05 Thread Terry Reedy
On 4/5/2015 1:45 PM, Alexey Izbyshev wrote: Hello! I've hit a strange problem that I reduced to the following test case: * Run several python processes in parallel that spin in the following loop: while True: if os.path.isfile(fname): with open(fname, 'rb') as f: f.read()

Is it possible to deliver different source distributions for different Python versions?

2015-04-05 Thread Dave Hein
I would like to distribute a python package with different code for Python 2.* than for Python 3.*. (Mostly this is because of different unicode string handling). There is nothing in to setuptools or PyPi that directly supports this scenario. But perhaps there could be some script run at install

ANN: polynice 0.7 - a nice(1) like utility for throttling processes

2015-04-05 Thread garabik-news-2005-05
polynice is a nice(1)-like command line utility for unix systems to throttle long running processes beyond what can be achieved by nice(1), by repeatedly suspending and resuming the process. It is written for python3, though there is some python2.7 compatibility. Author: Radovan Garabík URL: htt

Re: Help with pipes, buffering and pseudoterminals

2015-04-05 Thread Nobody
On Sun, 05 Apr 2015 12:20:48 -0700, Daniel Ellis wrote: > This only seems to print from the parent process. I read that I need to > do the os.read call for the fork to happen. I've also tried printing > *after* the os.read call. The child process has its std{in,out,err} attached to the newly-cr

Re: Help with pipes, buffering and pseudoterminals

2015-04-05 Thread Cameron Simpson
On 05Apr2015 12:20, Daniel Ellis wrote: I have a small little tool I'd like to make. It essentially takes piped input, modifies the text in some way, and immediately prints the output. The problem I'm having is that any output I pipe to the program seems to be buffered, removing the desired

Re: Is it possible to deliver different source distributions for different Python versions?

2015-04-05 Thread Steven D'Aprano
On Mon, 6 Apr 2015 06:38 am, Dave Hein wrote: > I would like to distribute a python package with different code for > Python 2.* than for Python 3.*. (Mostly this is because of different > unicode string handling). > > There is nothing in to setuptools or PyPi that directly supports > this scenar

XML Parsing

2015-04-05 Thread Sepideh Ghanavati
Hi, I know basic of python and I have an xml file created from csv which has three attributes "category", "definition" and "definition description". I want to parse through xml file and identify actors, constraints, principal from the text. However, I am not sure what is the best way to go. An

Re: XML Parsing

2015-04-05 Thread Ben Finney
Sepideh Ghanavati writes: > I know basic of python and I have an xml file created from csv What XML schema defines the document's format? Without knowing the schema, parsing will be unreliable. What created the document? Why is it relevant that the document was “created from CSV”? > which has

Re: Is it possible to deliver different source distributions for different Python versions?

2015-04-05 Thread Mark Lawrence
On 05/04/2015 21:38, Dave Hein wrote: I would like to distribute a python package with different code for Python 2.* than for Python 3.*. (Mostly this is because of different unicode string handling). There is nothing in to setuptools or PyPi that directly supports this scenario. But perhaps th

Re: Is it possible to deliver different source distributions for different Python versions?

2015-04-05 Thread Stefan Behnel
Dave Hein schrieb am 05.04.2015 um 22:38: > I would like to distribute a python package with different code for > Python 2.* than for Python 3.*. (Mostly this is because of different > unicode string handling). > > There is nothing in to setuptools or PyPi that directly supports > this scenario. >

Re: XML Parsing

2015-04-05 Thread Stefan Behnel
Sepideh Ghanavati schrieb am 06.04.2015 um 04:26: > I know basic of python and I have an xml file created from csv which has > three attributes "category", "definition" and "definition description". > I want to parse through xml file and identify actors, constraints, > principal from the text. Howe