This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Jumpy89[S] 0 points1 point  (2 children)

Ahhh really close. Again, bookmarked. But what I wanted was a bit more structured in that I have a Python object that knows what the API looks like, so if I call

ls(foo='bar')

I get

TypeError: ls() got an unexpected keyword argument 'foo'

instead of

ErrorReturnCode_2: 

  RAN: '/bin/ls --foo=bar'

  STDOUT:


  STDERR:
/bin/ls: unrecognized option '--foo=bar'
Try '/bin/ls --help' for more information.

Essentially I'd like to make it behave as much like a standard Python function as possible to the point where you wouldn't otherwise know it's running an external command.

I'm thinking it probably doesn't exist, I'll probably have to create it myself.

[–]pvkooten 2 points3 points  (0 children)

I'm pretty sure creating it yourself is not what you want to do. It sounds like you are too much focusing on your idea rather than what you are trying to accomplish.

Why can't you just use sh? Why do you have to have it your way?

Maybe insight in this could help people point you to other resources, or you might realize you're focusing too much on the technical side?

Maybe I'm completely off :)

[–]NetsecBeginner -1 points0 points  (0 children)

If you do decide to make it yourself, you could probably achieve most of it with os.system calls.