Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected int instead of string returned by get_dynamic_path(part, mask, metadata) #400

Open
patsch opened this issue Jan 30, 2021 · 3 comments

Comments

@patsch
Copy link

patsch commented Jan 30, 2021

  this_path = self.get_dynamic_path(part, mask, metadata)
                if this_path:
                    path.append(this_path.strip())

self.get_dynamic_path seems to sometimes return an unexpected int, which then causes this error:

File "elodie/elodie/filesystem.py", line 543, in process_file
directory_name = self.get_folder_path(metadata)
File "elodie/elodie/filesystem.py", line 366, in get_folder_path
path.append(this_path.strip())

AttributeError: 'int' object has no attribute 'strip'

@jmathai
Copy link
Owner

jmathai commented Jan 30, 2021

For reference, this seems related to #239 / #241. It shouldn’t hurt to cast the path to a string.

@patsch
Copy link
Author

patsch commented Jan 30, 2021

My 'fix':

def get_dynamic_path(self, part, mask, metadata):
        ret = self.get_dynamic_path_internal(part, mask, metadata)

        if type(ret) != str:
            ret = str(ret)

        return ret
            
    def get_dynamic_path_internal(self, part, mask, metadata):

@jmathai
Copy link
Owner

jmathai commented Jan 31, 2021

That should work --- you can probably skip the type check and just return str(ret).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants