'module' object has no attribute 'SaveFileName'


#1

G’day everyone,

I developed a script to export attributes to a CSV file. All worked well.

Copy and paste the functional part to a Command, save, close rhino, open rhino, run command as usual and this error pops up.


import rhinoscript.userinterface
import rhinoscript.geometry
import rhinoscriptsyntax as rs

__commandname__ = "naExportAttributes"

# RunCommand is the called when the user enters the command name in Rhino.
# The command name is defined by the filname minus "_cmd.py"


def RunCommand( is_interactive ):
      # Export all surface data as CSV    
    # create a filename variable
    filename = rs.SaveFileName("Save CSV file","*.csv||", None, "test", "csv")
    
    #open the file for writing
    file = open(filename, 'w')
    
    #create and write a header for the CSV file
    header = "Part Name,Area,Thickness,Throw,LCG,TCG,VCG\n"
    file.write(header)

          blah blah blah

    file.close()

Any thoughts? I’m stumped.

regards,
Nick


SR12 bug: Message: 'module' object has no attribute '_'
#2

This looks similar, I’ll give it a go.


#3

Removing both of these seems to “fix” the issue, but I’m now not sure if this change will cause other issues. At this stage it appears to be working fine though.


(Alain Cormier) #4

Hi Ncik,
Yes removing those imports and just using import rhinoscriptsyntax as rs is the right thing to do.
Alain