1

I am switching tool-chains, from an eclipse based python ide to a vim based equivalent.

I am currently experimenting with pudb.

I am trying to step through some code google gives as examples for tensorflow. It runs in a venv, on python3.5. None of the debuggers gives a problem on importing venv specific libraries, so I believe they are all operating in the intended venv.

pdb and ipdb both run/step through the code in its entirety without a problem - which is great.

When I try to run pudb I get the following error:

Traceback (most recent call last): 
File "~/interpreters/p35/lib/python3.5/site-packages/tensorflow/python/platform/app.py",
line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough)) TypeError: main() takes 0 positional arguments but 1 was given

The main is defined as follows:

def main(argv=None):  # pylint: disable=unused-argument    
   cifar10.maybe_download_and_extract()      
   if tf.gfile.Exists(FLAGS.train_dir):
     tf.gfile.DeleteRecursively(FLAGS.train_dir)
     tf.gfile.MakeDirs(FLAGS.train_dir)   
     train()


if __name__ == '__main__':   tf.app.run()

And tf.app.run() looks like this:

def run(main=None, argv=None):
   #Runs the program with an optional 'main' function and 'argv' list.
   f = flags.FLAGS
   # Extract the args from the optional `argv` list.
   args = argv[1:] if argv else None
   # Parse the known flags from that list, or from the command line otherwise.
   # pylint: disable=protected-access
   flags_passthrough = f._parse_flags(args=args)
   # pylint: enable=protected-access
   main = main or _sys.modules['__main__'].main
   # Call the main function, passing through any arguments to the final program.
   _sys.exit(main(_sys.argv[:1] + flags_passthrough))

I was really hoping to get pudb working on this code as I really like its interface.

I fidgeted with a alot of options here and am running up short. Anyone have any ideas about the variance here in operation between pdb, ipdb and pudb?

Thanks,

nt

alphaXed
  • 21
  • 3
  • Make sure `main` is what you expect it to be. Sometimes names get masked. – Klaus D. Apr 11 '17 at 18:47
  • @alphaXed.. Curious to know why you are switching toolchains? Is it just to try out the other side? I am using vim, ipython, ipdb.. not a IDE and wondering if I should move to Pycharm, because coding in vim has its disadvantages too.. – alpha_989 Nov 04 '17 at 12:03
  • @alpha_989 So I've ended up using atom, pudb and jupyter notebooks. This setup feels a little less bloated/top heavy than one based on an ide. I strayed away from vim only because setting up an environment on a new pc seems like something you need a manual for - essentially its configuration is pretty detail oriented and I'm already managing too many details. I've used pycharm and wingide before, they are both great products, same with eclipse - so nothing against ide's, I just feel really anti-motivated when I've got one up on screen. – alphaXed Dec 29 '17 at 19:39
  • Yeah.. you are right.. there is a learning curve in VIM. To smothen the learning curve you can start out with some preconfigured .vimrcs.. I pretty much spent the first 4 months, without changing anything in these plugins.. http://spf13.com/post/perfect-vimrc-vim-config-file/, https://github.com/jarolrod/vim-python-ide, https://github.com/amix/vimrc. But still, I agree, the vim ecosystem could use some streamlining.. – alpha_989 Dec 30 '17 at 18:59

0 Answers0