Hello,
When Run Dynamo script, shows me this error in Python script !
Try io.StringIO instead.
Have you tried just importing io?
Yes, give me the same error.
I want to upload the script, but it is not available to me
You can cut and paste the code?
Someone may be able to help more easily then.
import clr
import sys
import System
import re
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
from System.Collections.Generic import List
my_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments)
pf_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFilesX86)
sys.path.append(pf_path + '\\IronPython 2.7\\Lib')
from io.StringIO import StringIO
sys.stdout = StringIO()
import time
from datetime import timedelta
import traceback
import ctypes
def Mbox(title, text, style):
return ctypes.windll.user32.MessageBoxW(0, text, title, style)
import logging
import math
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')
clr.AddReference('System.Windows.Forms.DataVisualization')
clr.AddReference("System.Drawing")
clr.AddReference("System.Windows.Forms")
import System.Drawing
import System.Windows.Forms
from System.Drawing import *
from System.Windows.Forms import *
from System.Drawing import Point , Size , Graphics, Bitmap, Image, Font, FontStyle, Icon, Color, Region , Rectangle , ContentAlignment
from System.Windows.Forms import Button,Label,ListView,Form,CheckState
from cStringIO import StringIO
sys.stdout = StringIO()
import os
import webbrowser
import unicodedata
try:
errorReport = None
column_names = IN[0]
sublist = column_names
result = []
for n in range(len(sublist)):
items = [i for i, x in enumerate(sublist) if x == sublist[n]]
if items not in result:
if len(items) > 1:
result.append(sublist[n])
if len(result) != 0:
msgren = "You have Duplicate Column Names in Excel \\nDuplicate Column Names are: {}".format(str(result))
#Assign your output to the OUT variable.
output = Mbox('Error!',msgren.replace('set(', ''), 0x10)
else:
output = sublist
except:
# if error accurs anywhere in the process catch it
errorReport = traceback.format_exc()
if errorReport == None:
if output != 1:
mandatory = ["Element type Name","Layer Name"]
if all(s in output for s in mandatory):
OUT = output
else:
OUT = Mbox('Error!','Element type Name and Layer Name Missing in Excel Columns', 0x10)
else:
OUT = output
else:
OUT = Mbox('Error!',errorReport[errorReport.find('line'):]', 0x10)
I copied it, but it is now hidden from the system via Dynamo.
Hi,
Try
from io import StringIO