Re: A problem with opening a file -- again

2020-11-30 Thread Chris Angelico
On Tue, Dec 1, 2020 at 5:36 AM Dennis Lee Bieber wrote: > Off-hand, since you aren't explicitly using "del lf" it means that > __del__() is being called during the process shutdown. Thing is, there is > no guarantee during shutdown of when things are deleted. There is a faint > possibility

Re: A problem with opening a file -- again

2020-11-29 Thread Eryk Sun
On 11/29/20, Chris Angelico wrote: > > This seems like a really REALLY bad idea. You're putting a lot of work > into your __del__ function, and that's not getting called until > everything's shutting down. (Also, xrange doesn't exist, hence the > "exception ignored" thing.) > > Avoid putting this

Re: A problem with opening a file -- again

2020-11-29 Thread dn via Python-list
On 30/11/2020 10:36, Gabor Urban wrote: Hi guys, I tried to solve the problem once again. I have inserted some print statements the check the variables. The actual code (naplo.py) is copy-pasted here: Thanks = helpful +1 @Chris' response! Meantime, what happens if you start python, and ent

Re: A problem with opening a file -- again

2020-11-29 Thread Chris Angelico
On Mon, Nov 30, 2020 at 8:37 AM Gabor Urban wrote: > class Naplo: > def __del__(self): > if self.sor != 0: > if self.start: > trc = open(self.logNev,self.startMode) > else: > trc = open(self.logNev,self.mode) > for idx

A problem with opening a file -- again

2020-11-29 Thread Gabor Urban
Hi guys, I tried to solve the problem once again. I have inserted some print statements the check the variables. The actual code (naplo.py) is copy-pasted here: class Naplo: def __init__(self, pNeve, pMeret, pMode = 'a'): self.logNev = pNeve self.meret = pMeret

Re: A problem with opening a file

2020-11-29 Thread Dieter Maurer
Gabor Urban wrote at 2020-11-29 08:56 +0100: >I am facing an issue I was not able to solve yet. I have a class saving >messages to a file. The relevant code is: > > > >import OS >import sys > >class MxClass: > >def __init__(self, fName, fMode,): >self.fileName = fName >s

Re: A problem with opening a file

2020-11-29 Thread dn via Python-list
On 29/11/2020 20:56, Gabor Urban wrote: Hi, I am facing an issue I was not able to solve yet. I have a class saving messages to a file. The relevant code is: import OS if you're wanting the Python Standard Library, this should not be in upper-case import sys are these two imports

A problem with opening a file

2020-11-28 Thread Gabor Urban
Hi, I am facing an issue I was not able to solve yet. I have a class saving messages to a file. The relevant code is: import OS import sys class MxClass: def __init__(self, fName, fMode,): self.fileName = fName self.fileMode = fMode def writeMetho