daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 115 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from pathlib import Path
  2. import os
  3.  
  4. dirs_to_match = ['33','28']
  5. # dirs_to_match = ['foo','bar']
  6.  
  7. start_dir = '~/MR_DATA/20180207_ket'
  8. matches = []
  9. for root, dirs, files in os.walk(Path(start_dir).expanduser().absolute()):
  10.     for d in dirs:
  11.         if d in dirs_to_match:
  12.             matches.append(Path(root)/d)
  13.            
  14. print(matches)
  15.  
  16. [PosixPath('/home/virtualfelix/MR_DATA/20180207_ket/28'), PosixPath('/home/virtualfelix/MR_DATA/20180207_ket/33')]
  17.  
  18. import convert_bruker_func.py as convert2dseq
  19.  
  20. for elements in matches:
  21.     convert2dseq(elements)
  22.  
  23. ---------------------------------------------------------------------------
  24. TypeError                                 Traceback (most recent call last)
  25. <ipython-input-58-ea511db08ea6> in <module>()
  26. ----> 1 import convert_bruker_func.py as convert2dseq
  27.       2
  28.       3 for elements in matches:
  29.       4     convert2dseq(elements)
  30.  
  31. ~/MR_DATA/linuxscripts/Python/convert_bruker_func.py in <module>()
  32.      98
  33.      99
  34. --> 100 main()
  35.  
  36. TypeError: main() missing 1 required positional argument: 'cwd'
RAW Paste Data
Top