enthought / envisage

Envisage is a Python-based framework for building applications whose functionalities can be extended by adding "plug-ins".
http://docs.enthought.com/envisage/
Other
81 stars 26 forks source link

Ensure the tasks state directory exists before saving state #489

Closed corranwebster closed 1 year ago

corranwebster commented 1 year ago

Includes a test.

Fixes #488

corranwebster commented 1 year ago

Any idea why this isn't working as intended?

Not 100%. It that could mean the issue is actually in Canopy Data.

But there is something a bit dodgy about _initialize_application_home in that it isn't using self.state_location but a hard-coded path instead: if state_location changes after __init__ then you'll end up with this situation.

mdickinson commented 1 year ago

But there is something a bit dodgy about _initialize_application_home

Agreed: we should definitely be using self.state_location there. If I make that change, then the state directory is created as expected.

if state_location changes after __init__

Hmm. I suspect it shouldn't, in general. Do we have examples of applications that do this deliberately?

corranwebster commented 1 year ago

Hmm. I suspect it shouldn't, in general. Do we have examples of applications that do this deliberately?

I can see it might be used in testing. I'll dig a bit more into what Canopy Data is doing.

corranwebster commented 1 year ago

OK - this is at least a bit Canopy Data's fault - it is overriding _initialize_application_home and not calling super in it, so the tasks subdirectory is not being created.

I need to revise things, as I recall there being issues around all of this initialization code.

corranwebster commented 1 year ago

I think I have tracked this down - Canopy Data was not calling super because of #464. I think the correct fix is to remove Canopy Data's _initialize_application_home.

Closing (at least for now)

mdickinson commented 1 year ago

we should definitely be using self.state_location there

I've opened #490 for this.