Dynamo sandbox working, refinery not

Hi guys!

I have made a simple graph in Dynamo Sandbox (no revit nodes involved) with a complex python node which is ALWAYS working.
All the combinations of the sliders can produce 2 results:

  1. a building is modeled and some goals calculated
  2. if the combination doesn’t exist (not all combination are a possible configuration) a red box is modeled and the two goals are set to None (I also tried to set them equal to 0 or other number)

In every possible cases there is NO ERROR OR WARNING IN THE GRAPH: I always get a model with some goals.

When I launch refinery i got this:

and I see 2 problems:

  • there is no goal, which means something went wrong in the graph (which is always working)
  • refinery, instead of the optimized combinations, is choosing ONLY the wrong ones (which IN DYNAMO output a red box and None values for the goals) without displaying the previews and the goal values.

I already tried:

  • everything available on this forum
  • deleting all the previous study from refinery
  • checking if refinery is working (I used a very simple graph and it’s working properly)

Since I can’t share the code and since it’s working in every cases in Sandbox, I was hoping someone has a different approach to solve this issue or maybe other ideas.

(I think it is also wise to involve @Lilli_Smith for this kind of issue)

Thanks in advance for your help!

Dynamo Sanbox version:
Refinery version: 0.35

1 Like

I think you are a few months behind with your refinery version, and a few months ahead on the Dynamo version. Try updating to 0.65 (I think) or whatever the current build of Refinery is. If that doesn’t work you may need to share your code.

This is also better posted in the Refinery beta forum where the Refinery development team (including Lilli) is active.

Hi Jacob, as a colleague I know that the latest Refinery has the same issues in this case. We did test that. Will have a look on the Refinery forum, thnx!

In that case it’s likely that there is a call to an external API which is either blocked by licensing, requires multi-threading, or has some other stopper in it. Make sure you’ve got some robust error handling in the output of the Python node, and try writing any errors to a text file on each run, and then do a small test in Refinery to see what comes out.


On top of what Jacob suggested, try to use this snippet of code in your Python Script to see what is happening and why it is not working.

import logging
import tempfile
import os

FORMAT = '[%(asctime)-15s] %(levelname)s: %(module)s.%(funcName)s %(message)s'
logging.basicConfig(filename=os.path.join(tempfile.gettempdir(), 'MY_LOG_FILE.log'), level=logging.DEBUG,
                    format=FORMAT, datefmt='%Y/%m/%d %I:%M:%S')

def my_func():
        # do something
        logging.info('My Custom message')  # this will log something like: [2020/03/16 03:31:00] INFO: <python_file_name>.my_func My Custom message
         a = 1 / 0  # this is an error on purpose
    except Exception() as ex:
        logging.error(ex.message)  # this will log something like: [2020/03/16 03:31:00] ERROR: <python_file_name>.my_func <error message text>

You have different levels such as INFO, WARNING and ERROR and you can customize the message.
Before using it into production just remove the “level” variable in the basicConfig to only capture the critical messages.


Hi @JacobSmall and @Paolo_Emilio_Serra1, sorry for the late reply and thanks for your suggestions! They are both very useful!
In the end, the function to blame was os.path.dirname() and after replacing it with os.path.expanduser() I managed to solve in a different way the task of getting the file path dynamically, which was causing the problem (only) in Refinery.