title: Python script works in current directory but not when one is specified
body: <p>When I try to just print the content is work in other locations as well.</p>
  <p>But when I want files to show their size as well, it only works in the current path.</p>
  <pre><code>import os
  import sys
  
  #check if a path is provided
  #else use the current loction
  arg_list = len(sys.argv) -1
  
  if arg_list != 1:
      path = '.' 
  elif arg_list == 1:
      path = sys.argv[1]
  
  #list the files and directorys
  #if it is a file also show it's size
  catalog = os.listdir(path)
  
  for item in catalog:
      #just print() here works also for other directories
      if os.path.isdir(item):
          print(f'    {item}')
  
      elif os.path.isfile(item):
          size = os.path.getsize(item)
          print(f'{size} {item}')
  </code></pre>