brightway-lca / brightway2-io

Importing and exporting for the Brightway LCA framework
BSD 3-Clause "New" or "Revised" License
26 stars 40 forks source link

fix unsupported operand #204

Closed patquem closed 1 year ago

patquem commented 1 year ago
Path(dirname) / name + '.json'

TypeError: unsupported operand type(s) for +: 'WindowsPath' and 'str'

mfastudillo commented 1 year ago

Can you provide an example of when this error takes place ? I fail to see why the change will fix anything. If "name" is not a string but a pathlib.Path the typerror will take place anyway.

cmutel commented 1 year ago

@mfastudillo I think the problem is in the order of operations, the / comes first in my testing. But this is not then a Windows problem, it is a problem everywhere.

@patquem Please cast name to a str before appending the suffix (or use pathlib to append a suffix), and add a simple test.

patquem commented 1 year ago

Hello, my PR just fixes a "basic" bug without recasting to stror Pathlib just by revisiting the order of operations ( Pathlib / (str + str) instead of (Pathlib / str) + str ). I am sorry, but I am not a Brightway user and I am out of time for this. I just spent some time helping a friend of mine to find a solution in term of simapro-ecoinvent datasets compatibility. If my PR is not enough, feel free to make and push your own bug fix with the dedicated test (if required) :)