RooWorkspace (RooFit) not importing in PyRoot

Hi all (Wim),

I was trying to use the RooWorkspace object today with PyRoot and to test it out, I converted one of the tutorials, rf502_wspacewrite.C, to PyRoot.

Unfortunately, I’m getting an error when I try to import one of the PDF’s.

File "./", line 57 w.import(model) ^ SyntaxError: invalid syntax

I’m attaching my code. Any help would be greatly appreciated.

Matt (2.38 KB)


yes, “import” is a keyword and can thus not be used as a method. Easiest workaround would be:[code]# Import model and all its components into the workspace

Import data into the workspace



Thanks, Wim. Worked like a charm. I had some other parts of the script that were not properly PyRoot’ed. I fixed those and it seems to be swinging. I’m attaching the corrected script for completeness sake.

Matt (2.43 KB)