PIA-Group / BioSPPy

Biosignal Processing in Python
Other
573 stars 274 forks source link

Walktree not working #38

Closed mc-m closed 6 years ago

mc-m commented 6 years ago

I can't seem to obtain any resut from the walktree function.

I'm doing this: filename = walktree(top= '../../data/Trials', spec=r'\.XML$')

and the function acts like if I had no file in that directory whatsoever (see images for better understanding).

Thank you

cenas sem titulo
capcarr commented 6 years ago

Hi @mc-m It seems that in your call to walktree you have two extra ` It should just be r'\.txt$'

mc-m commented 6 years ago

Yes, you were right, thank you!

However, I'm getting another error. Not sure if it's about this fuction or not.

github

Also, @capcarr, how does the function return the file names when there's more than one? Is it a list?

Thank you,

capcarr commented 6 years ago

Hi @mc-m

The function returns a generator function, which are useful in iterative loops.

You can obtain a list with all the elements by doing: files = list(walktree(...))

Regarding your error, it seems that you are feeding the variable filename to another function, which expects a string. You probably wanted to pass f.