Comment 1 for bug 316691

Revision history for this message
sjgcit (sg-euroapps) wrote :

I do not think the proposed fix does not address the problem.

The underlying issue is that __file__ when split has an empty path. This can occur if the application is run from the command line locally.

I think the correct fix is to replace ALL occurrences of os.path.split(__file__) with os.path.split( os.path.abspath( __file__ ) )

This method always returns a valid path and leafname and avoid replicating checking code every time the path is needed.

I'd suggest setting a global ( to hold that path result ) during initialisation. This would avoid making multiple calls to two functions that are going to return what will be a constant during runtime.

Please note this issue ALSO occurs in generated code. Generated code should also use this approach ( because we don't know that the resulting code is not going to be executed locally from a command line ).