TypeError in mcnp2fluka.py converter (argument of type 'float' is not iterable)

Versions

Please provide the used software versions.

FLUKA:4-5.1 (gfor>=9)
Flair:3.4-5
Operating system:Ubuntu 24.04.1 LTS (Windows 11 WSL)

Description

Hello,

I am trying to import an MCNP file into Flair, but I am encountering a Python error.

Actions Taken:

  1. Open Flair.

  2. Go to FileImportMCNP...

  3. Select my MCNP input file.

Result: The import fails, and the following error appears in the terminal:

Traceback (most recent call last):
File “/usr/local/flair/tkFlair.py”, line 1557, in call
return self.func(*args)
^^^^^^^^^^^^^^^^
File “/usr/local/flair/flair.py”, line 1575, in importMcnp
self.project.input = self._convertInput(mcnp, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/flair/flair.py”, line 1049, in convertInput
return convert.input(inp, mode, self.newLog(“flair”,“convert”),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/flair/convert/init.py”, line 39, in input
return class
(inp, name, log).convert(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/flair/convert/convert.py”, line 130, in convert
self._convert(**kwargs)
File “/usr/local/flair/convert/convert.py”, line 295, in _convert
self.convertRegions(rotdefi)
File “/usr/local/flair/convert/mcnp2fluka.py”, line 524, in convertRegions
if " " in body:
^^^^^^^^^^^
TypeError: argument of type ‘float’ is not iterable

This TypeErrorsuggests the converter was expecting a string but received a float, likely during region conversion.

My Question: Could this error be caused by a specific MCNP syntax in my geometry definition (cells or surfaces) that the mcnp2fluka.pyscript does not support?

Thank you for any guidance you can provide.

Benson

Input files

Please upload all relevant files. (FLUKA input file, Flair project file, user routines, and data files)

I can download flair-geoviewer-3.1-4.tgz, flair-geoviewer-3.2-1.tgz, and flair-geoviewer-3.3-1.tgz from https://flair.web.cern.ch/flair/download, but I cannot find flair-3.1-4.tar.gz, flair-3.2-1.tar.gz, or flair-3.3-1.tar.gz. I would like to test the MCNP input file import function of these three versions. Could a kind person provide these three files for me? Thank you in advance for your help!

Hi @benson

  1. just replace the .tar.gz with .tgz and you will be able to download the files e.g. flair-3.1-4.tgz
  2. to debug and fix your mcnp2fluka error we would need your mcnp geometry. you could send with a private message if you want

Please try the latest version we just uploaded on the server 3.4-5.2
Normally it should fix the your problem.
My guess is that it was caused by a cell that was refering to some problematic surface.
Still it would be interesting to have your mcnp input to fully debug it