Cannot Clear Excel Contents with Bumblebee Node

I am attempting to clear Excel data with the use of Bumblebee’s Clear Contents node. However no matter what I do, the excel data will not clear. See video for example and attachments for test excel file and dynamo graph. Any help would be greatly appreciated.

exceltest.dyn (4.2 KB)

ExcelClearContentsTest.xlsx (8.8 KB)

I know this is a late time coming, and you may have moved on or since found a solution, but for anyone who stumbles upon this, just like I did, when recently having the same issues, I’m posting an answer here as an interim solution while I notify the Bumblebee’s author of the issue.

The issue occurs in line 105 of the python script driving the Clear Contents node of the plugin. The line reads if os.path.isfile(str(filePath)): inside of a try: statement. The problem is, the only time os is imported is in line 18: from os import path. This is an issue because line 105 has no idea what namespace os is, only the path namespace from os, and so it fails, causing the except: clause to kick into play. This bypasses any write operation onto the file and immediately ends the script and releases Excel com properties. Unfortunately, there’s no line setting a message override in that except: clause, so “Success!” is all that displays from the node dispite the overall operation failure.

The Solution:
There’s a few ways to handle this, but effectively you have to eliminate the “unknown” aspect of the os namespace.

Option A:
Remove “os.” entirely from lines 18 and 105.
NOTE: Least stable and readable due to lack of specificity of the name “path”

Option B:
Update line 18 to read as from os import path as ospath, then update line 105 from os.path to ospath.
NOTE: Recommended option.

Option C:
Change line 18 to import os.
NOTE: This would import all of the os namespace, which is otherwise unused. This option is not recommended due to possible and untested performance issues.

1 Like