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

TypeError: unsupported operand type(s) for /: 'str' and 'str' #30

Open
hursh-desai opened this issue Jan 20, 2023 · 4 comments
Open

TypeError: unsupported operand type(s) for /: 'str' and 'str' #30

hursh-desai opened this issue Jan 20, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@hursh-desai
Copy link

Dunno what in my notes could possibly be triggering this error. But it happens whenever I try and use the get_note_metadata() method on my vault.
image

@macdrifter
Copy link

Seeing the same issue when running vault.get_note_metadata with the vault object.

Output exceeds the size limit. Open the full output data in a text editor
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-5147b4bd015c> in <module>
      1 vault.connect()
----> 2 print(vault.get_note_metadata())

~/opt/miniconda3/envs/jupyter/lib/python3.9/site-packages/obsidiantools/api.py in get_note_metadata(self)
   1154               .rename(columns={'file_exists': 'note_exists'})
   1155               .rename_axis('note'))
-> 1156         df = (df.pipe(self._create_note_metadata_columns)
   1157               .pipe(self._clean_up_note_metadata_dtypes)
   1158               )

~/opt/miniconda3/envs/jupyter/lib/python3.9/site-packages/pandas/core/generic.py in pipe(self, func, *args, **kwargs)
   5510         ...  )  # doctest: +SKIP
   5511         """
-> 5512         return com.pipe(self, func, *args, **kwargs)
   5513 
   5514     # ----------------------------------------------------------------------

~/opt/miniconda3/envs/jupyter/lib/python3.9/site-packages/pandas/core/common.py in pipe(obj, func, *args, **kwargs)
    495         return func(*args, **kwargs)
    496     else:
--> 497         return func(obj, *args, **kwargs)
    498 
...
-> 1167                                       [self._dirpath / str(f)
   1168                                        for f in df['rel_filepath'].tolist()],
   1169                                       np.NaN)

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

I love the idea of getting a data frame back so thank you for thinking about that.

@mfarragher mfarragher added the bug Something isn't working label Mar 16, 2023
@daneah
Copy link

daneah commented Apr 9, 2023

I ran into this as well—it seems you can get around this by wrapping your supplied vault path in pathlib.Path so that it isn't a raw string.

@mfarragher
Copy link
Owner

@hursh-desai @macdrifter was this issue from the vault's dirpath not being a pathlib.Path object? (like with @daneah comment)
If that's the case, this wouldn't be a bug as the library is set up to use pathlib paths rather than strings for directory arguments (dirpath (pathlib Path) in the docstring).

Pandas pipe functions are neat but maybe not as straightforward for debugging, so I might explore moving some logic away from those.

@jb-lafon
Copy link

@mfarragher @hursh-desai I had the same issue as above and changed the vault path to a pathlib.Path object and it worked great. Indeed not a bug but not very explicit in the current documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants