Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use madx.help() #39

Closed
Landau1908 opened this issue Oct 8, 2016 · 3 comments
Closed

How to use madx.help() #39

Landau1908 opened this issue Oct 8, 2016 · 3 comments

Comments

@Landau1908
Copy link

Hi, Thomas
I want to obtain the help information about a madx command via madx.help(), but I can't obtain anything. How to do?

from cpymad.madx import Madx
madx = Madx()
print madx.help("twiss")

output:

None
@coldfix
Copy link
Member

coldfix commented Oct 18, 2016

the output of the help command is just printed to STDOUT - so unless you close STDOUT, you don't need print. There is also a way to get the text in a variable by temporarily capturing STDOUT (in the remote process), but you will have to code that on your own.

@coldfix coldfix closed this as completed Oct 18, 2016
@Eothred
Copy link
Contributor

Eothred commented Mar 1, 2017

Looking at https://github.com/hibtc/cpymad/blob/master/cpymad/madx.py#L303, I think there is a minor error (relates to this question).

The line is self.command.help(cmd=cmd) which I think means that madx.help('twiss') is sent to madx as help,cmd='twiss';. Perhaps it should be self.command.help(cmd), which would result in madx getting the call `help,twiss;' instead.

@coldfix
Copy link
Member

coldfix commented Mar 1, 2017

you're right, the quotes don't work. I had changed the generic representation of string values from bare words to quoted strings in c35c533 due to another issue. I will add a fix later.

coldfix added a commit that referenced this issue Mar 1, 2017
as pointed out in #39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants