|
POST
|
ok my last post seems to stem from too many fields....I narrows down to 10 adn I was able to add Style to my table being built. Were my results from your code what you were expecting? THANKS for all your help....much appreciated.
... View more
12-19-2016
11:59 AM
|
0
|
0
|
2556
|
|
POST
|
Im also trying this approach... BUT NO MATTER what I do to try and format the column widths and table widths nothing changes... thoughts? ##First, create the texts of the columns:
cols = ["<td style='width:100px'>{0}</td>".format( "<td style='width:100px'></td>".join(t)) for t in your_list]
##then use it to join the rows (tr)
rows = "<tr style='width:100px'>{0}</tr>".format( "<tr style='width:100px'>\n</tr><br><br><br>".join(cols))
##finaly, inject it into the html...
html1 = """<HTML> <body>
<h1>Attendance list</h1>
<table style="width:100%">
{0}
</table>
</body>
</HTML>""".format(rows)
part4 = MIMEText(html1, 'html')
msg.attach(part4)
... View more
12-19-2016
11:29 AM
|
0
|
1
|
2556
|
|
POST
|
I used your code in a separate .py file and this is what I got....Is this what you are expecting I needed to modify the "mylist2" variable in this line, because it just said "mylist" mylistitem = (["""<a href=>""" + str(i) + """</a>""" for i in mylist2]) RESULTS: Python Script Errors & Logging Reports | Errors Items | | Log Items | [1, 'blah', 'blah2', 'blah3', 'blah4', 'blah5'] [2, 'blah33', 'blah44', 'blah55', 'blah66', 'blah77'] [3, 'blah111', 'blah222', 'blah333', 'blah444', 'blah555']
... View more
12-19-2016
11:20 AM
|
0
|
6
|
8222
|
|
POST
|
I tweaked this line and got the lines to separate...added 2 <br> mylistitem = (["""<a href=>""" + str(i) + """</a><br><br>""" for i in your_list]) Questions: Should I be expecting the Headers to show up before each value in each of the 2 record returns? What result should I be expecting from your code? Python Script Errors & Logging Reports | Log Items | region , county , ramp , date , trailblazers , TrailDes , TrailActionT , railActionN , regulations , RegDes , RegActionT , regActionN , safteygsign , safteygsignP , safteygsignT , safteygsignN , rutfree , rutfreeP , rutfreeT , rutfreeN , potholes , potholesP , potholesT , potholesN , grass , grassP , grassT , grassN , trash , trashP , trashT , trashN , portapotties , portapottiesP , portapottiesT , portapottiesN , lighting , lights , lightingP , lightingT , lightingN , courtesypier , courtesypierP , courtesypierT , courtesypierN , boatslide , boatslideP , boatslideTaken , boatslideN , fishingpier , fishingpierP , fishingpierT , fishingpierN , debris , debrisP , debrisT , debrisN , potholesramp , potholesrampP , potholesrampT , potholesrampN , bulkhead , bulkheadP , bulkheadT , bulkheadN , shoreline , shorelineP , shorelineT , shorelineN , contractor , contractorduties , co ntractorP , contractorT , contractorN , comments , CreationDate , Creator , EditDate , Editor , Lat , Long 3 , Grayson , Independence , 2016-11-23 16:31:59 , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , no , None , None , None , None , no , None , None , None , no , None , None , None , no , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , no , None , None , None , None , JUNK RECORD , 2016-11-23 16:32:22 , BoatGuest , 2016-11-23 16:32:22 , BoatGuest , 36.57220761 , -81.1524287%s 3 , Grayson , Bridle Creek , 2016-11-23 16:44:01 , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , no , None , None , None , None , no , None , None , None , yes , fdff , fggv , g b v , no , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , yes , None , None , None , no , None , None , None , None , JUNK RECORD , 2016-11-23 16:44:28 , BoatGuest , 2016-11-23 16:44:28 , BoatGuest , 36.59588241 , -81.24224305%s
... View more
12-19-2016
10:54 AM
|
0
|
8
|
8222
|
|
POST
|
When I use your code James I get this...I was looking for something that would look more formatted as line items...did I do something wrong? with open('z_outFileRegion1.csv', 'rb') as f:
reader = csv.reader(f)
your_list = list(reader)
mylistitem = (["""<a href=>""" + str(i) + """</a>""" for i in your_list])
merged = [item for sublist in zip(mylistitem) for item in sublist]
htmlline = '\n'.join(merged)
#print htmlline
html = """\
<html>
<head></head>
<body>
<p><br>
Python Script Errors & Logging Reports<br> <br> <br>
| Log Items | <br>
""" + htmlline + """<br> <br>
</p>
</body>
</html>
"""
print html Python Script Errors & Logging Reports | Log Items | ['region', 'county', 'ramp', 'date', 'trailblazers', 'TrailDes', 'TrailActionT', 'railActionN', 'regulations', 'RegDes', 'RegActionT', 'regActionN', 'safteygsign', 'safteygsignP', 'safteygsignT', 'safteygsignN', 'rutfree', 'rutfreeP', 'rutfreeT', 'rutfreeN', 'potholes', 'potholesP', 'potholesT', 'potholesN', 'grass', 'grassP', 'grassT', 'grassN', 'trash', 'trashP', 'trashT', 'trashN', 'portapotties', 'portapottiesP', 'portapottiesT', 'portapottiesN', 'lighting', 'lights', 'lightingP', 'lightingT', 'lightingN', 'courtesypier', 'courtesypierP', 'courtesypierT', 'courtesypierN', 'boatslide', 'boatslideP', 'boatslideTaken', 'boatslideN', 'fishingpier', 'fishingpierP', 'fishingpierT', 'fishingpierN', 'debris', 'debrisP', 'debrisT', 'debrisN', 'potholesramp', 'potholesrampP', 'potholesrampT', 'potholesrampN', 'bulkhead', 'bulkheadP', 'bulkheadT', 'bulkheadN', 'shoreline', 'shorelineP', 'shorelineT', 'shorelineN', 'contractor', 'contractorduties', 'c ontractorP', 'contractorT', 'contractorN', 'comments', 'CreationDate', 'Creator', 'EditDate', 'Editor', 'Lat', 'Long'] ['1', 'King WIlliam', 'Lestor Manor', '2016-09-21 14:41:07', 'yes', 'na', 'na', 'na', 'no', 'Human feces all over sign', 'Sprayed with cleaner and washed off with bucket of water', 'None fruther', 'yes', 'na', 'na', 'na', 'yes', 'na', 'na', 'na', 'no', 'Erosion starting from hill', 'None', 'Will continue to monitor and follow up', 'no', 'na', 'Mowed grass', 'na', 'yes', 'na', 'na', 'na', 'yes', 'na', 'na', 'na', 'no', 'Yes', 'na', 'na', 'na', 'no', 'na', 'na', 'na', 'no', 'na', 'na', 'na', 'no', 'na', 'na', 'na', 'yes', 'na', 'na', 'na', 'yes', 'na', 'na', ' na', 'yes', 'na', 'na', 'na', 'yes', 'na', 'na', 'na', 'no', 'No', 'na', 'na', 'na', 'Note: Fishing line recycling tube full of trash need to monitor and remove if continues to be problem ', '2016-09-21 14:44:17', 'jkirk922', '2016-11-08 18:28:54', 'jay.ki', '37.5861196', '-76.98457474%s'] ['1', 'King & Queen', 'Waterfence', '2016-09-21 15:46:31', 'no', 'Missing trail blazer from tree work', 'Replaced', 'None', 'yes', 'na', 'na', 'na', 'yes', 'na', 'na', 'na', 'yes', 'na', 'na', 'na', 'no', 'Pothole forming', 'None', 'Monitor and fill with cold patch', 'no', 'na', 'Mowed grass', 'na', 'yes', 'na', 'na', 'na', 'yes', 'na', 'na', 'na', 'no', 'Yes', 'na', 'na', 'na', 'no', 'na', 'na', 'na', 'no', 'na', 'na', 'na', 'no', 'na', 'na', 'na', 'yes', 'na', 'na', 'na', 'yes', 'na', 'na', ' na', 'yes', 'na', 'na', 'na', 'yes', 'na', 'na', 'na', 'no', 'No', 'na', 'na', 'na', 'na', '2016-09-21 15:48:08', 'jkirk922', '2016-11-08 18:28:54', 'jay.ki', '37.59206276', '-76.79871466%s']
... View more
12-19-2016
09:35 AM
|
0
|
10
|
8222
|
|
POST
|
Geeze thanks Blake...you are so kind. I simple suggestion steering me towards printing in python would have been nice. Is there anyone out there, someone that choose not to insult people, that have any idea of how to do this. I dont care if its HTML just thought that might be an easier option formatting wise.
... View more
12-19-2016
06:09 AM
|
0
|
2
|
2556
|
|
POST
|
Im getting close but this results in the below.... how can I make the fields widths wider so I can read it... with open('z_outFileRegion1.csv', 'rb') as f:
reader = csv.reader(f)
your_list = list(reader)
#First, create the texts of the columns:
cols = ["<td>{0}</td>". format( "</td><td>".join(t) ) for t in your_list]
#then use it to join the rows (tr)
rows = "<tr>{0}</tr>".format( "</tr>\n<tr>".join(cols) )
#finaly, inject it into the html...
html1 = """<HTML> <body>
<h1>Attendance list</h1>
<table>
{0}
</table>
</body>
</HTML>""".format(rows)
part3 = MIMEText(html1, 'html')
msg.attach(part3) Attendance list region county ramp date trailblazers TrailDes TrailActionT railActionN regulations RegDes RegActionT regActionN safteygsign safteygsignP safteygsignT safteygsignN rutfree rutfreeP rutfreeT rutfreeN potholes potholesP potholesT potholesN grass grassP grassT grassN trash trashP trashT trashN portapotties portapottiesP portapottiesT portapottiesN lighting lights lightingP lightingT lightingN courtesypier courtesypierP courtesypierT courtesypierN boatslide boatslideP boatslideTaken boatslideN fishingpier fishingpierP fishingpierT fishingpierN </> debris debrisP debrisT debrisN potholesramp potholesrampP potholesrampT potholesrampN bulkhead bulkheadPbulkheadTbulkheadNshorelineshorelinePshorelineTshorelineNcontractorcontractordutiescontractorPcontractorTcontractorNcommentsCreationDateCreatorEditDateEditorLatLong 1 King WIlliam Lestor Manor 2016-09-21 14:41:07 yes na na na no Human feces all over sign Sprayed with cleaner and washed off with bucket of water None fruther yes na na na yes na na na no Erosion starting from hill None Will continue to monitor and follow up no na Mowed grass na yes na na na yes na na na no Yes na na na no na na na no na na na no na na na yes na na na yes na na na yes nananayesnanananoNo nananaNote: Fishing line recycling tube full of trash need to monitor and remove if continues to be problem 2016-09-21 14:44:17jkirk9222016-11-08 18:28:54jay.ka3.5861196-7.98457474%s
... View more
12-16-2016
01:28 PM
|
0
|
1
|
8222
|
|
POST
|
I can create an array, convert to string and put that in some HTML formatting and add it to the email But I just get a huge jumbled mess of comma delimited list/string in the email...there is no formatting... Is there a way to format the Array and add that to the email Is there a way to parse/split the string and format that? Is there a way to split the string on a specific "," (index) and then at least add a space between lines in the email? date_list = mylist
date_list_string = "\n".join(date_list) # edit this to match the desired output
html = """<html>
<head></head>
<body>
<p>These are the available dates: </p>
""" + date_list_string + """"
</body>
</html>
"""
part3 = MIMEText(html, 'html')
msg.attach(part3)
I GET THIS: 1,King WIlliam,Lestor Manor,2016-09-21 14:41:07,yes,na,na,na,no,Human feces all over sign,Sprayed with cleaner and washed off with bucket of water,None fruther,yes,na,na,na,yes,na,na,na,no,Erosion starting from hill,None,Will continue to monitor and follow up,no,na,Mowed grass,na,yes,na,na,na,yes,na,na,na,no,Yes,na,na,na,no,na,na,na,no,na,na,na,no,na,na,na,yes,na,na,na,yes,na,na, na,yes,na,na,na,yes,na,na,na,no,No,na,na,na,Note: Fishing line recycling tube full of trash need to monitor and remove if continues to be problem ,2016-09-21 14:44:17,jkirk922,2016-11-08 18:28:54,jay.kai,3.5861196,-7.98457474 1,King & Queen,Waterfence,2016-09-21 15:46:31,no,Missing trail blazer from tree work,Replaced,None,yes,na,na,na,yes,na,na,na,yes,na,na,na,no,Pothole forming,None,Monitor and fill with cold patch,no,na,Mowed grass,na,yes,na,na,na,yes,na,na,na,no,Yes,na,na,na,no,na,na,na,no,na,na,na,no,na,na,na,yes,na,na,na,yes,na,na, na,yes,na,na,na,yes,na,na,na,no,No,na,na,na,na,2016-09-21 15:48:08,jkirk922,2016-11-08 18:28:54,jay.kai,3.59206276,-7.79871466 AT A MINIMUM WAN THIS: 1,King WIlliam,Lestor Manor,2016-09-21 14:41:07,yes,na,na,na,no,Human feces all over sign,Sprayed with cleaner and washed off with bucket of water,None fruther,yes,na,na,na,yes,na,na,na,no,Erosion starting from hill,None,Will continue to monitor and follow up,no,na,Mowed grass,na,yes,na,na,na,yes,na,na,na,no,Yes,na,na,na,no,na,na,na,no,na,na,na,no,na,na,na,yes,na,na,na,yes,na,na, na,yes,na,na,na,yes,na,na,na,no,No,na,na,na,Note: Fishing line recycling tube full of trash need to monitor and remove if continues to be problem ,2016-09-21 14:44:17,jkirk922,2016-11-08 18:28:54,jay.kapalczynski,3.5861196,-7.98457474 1,King & Queen,Waterfence,2016-09-21 15:46:31,no,Missing trail blazer from tree work,Replaced,None,yes,na,na,na,yes,na,na,na,yes,na,na,na,no,Pothole forming,None,Monitor and fill with cold patch,no,na,Mowed grass,na,yes,na,na,na,yes,na,na,na,no,Yes,na,na,na,no,na,na,na,no,na,na,na,no,na,na,na,yes,na,na,na,yes,na,na, na,yes,na,na,na,yes,na,na,na,no,No,na,na,na,na,2016-09-21 15:48:08,jkirk922,2016-11-08 18:28:54,jay.kai,3.59206276,-7.79871466
... View more
12-16-2016
12:46 PM
|
0
|
14
|
8222
|
|
POST
|
I am trying to write the contents of a csv to the body of an email and of course having issues. I can list out the contents as such. But looking for a formatted HTML version that I can place in the body of an email...I have been through a dozen of forums and cant seem to find a simple solution and one that works.. csv.register_dialect(
'mydialect',
delimiter = ',',
quotechar = '"',
doublequote = True,
skipinitialspace = True,
lineterminator = '\r\n',
quoting = csv.QUOTE_MINIMAL)
print("\n Now the output from a dictionary created from the csv file")
with open('z_outFileRegion1.csv', 'rb') as mycsvfile:
dictofdata = csv.DictReader(mycsvfile, dialect='mydialect')
for row in dictofdata:
print(row['region']+"\t "+row['county']+"\t "+row['ramp']) I tried this one but cant get it to work python - Send the contents of a CSV as a table in an email? - Stack Overflow Python send email from a csv list - Stack Overflow Anyone have any easy solution to grab the CSV, format with HTML and attach it to the body of the email? Below I am attaching the csv to the email but want to display the records in the email itself. filename = "z_outFileRegion1.csv"
f = file(filename)
#===BUILD EMAIL========================================
def msgEmail():
msg = MIMEMultipart()
#body = "This is the message"
#content = MIMEText(body, 'plain')
#msg.attach(content)
attachment = MIMEText(f.read())
attachment.add_header('Content-Disposition', 'attachment', filename=filename)
msg.attach(attachment)
msg['Subject'] = "Region Report " + CurrentDate
server = smtplib.SMTP('smtp1.fff',25)
server.set_debuglevel(1)
server.ehlo()
server.sendmail(FROMADDR, TOADDRS, msg.as_string())
server.quit()
#===PROCESS EMAIL======================================
getMsgP = msgEmail()
print getMsgP
... View more
12-16-2016
08:04 AM
|
0
|
18
|
24299
|
|
POST
|
Got it here...pain to get to this page. Survey123 for ArcGIS | ArcGIS
... View more
12-07-2016
12:43 PM
|
0
|
1
|
1294
|
|
POST
|
I know that you can download the Survey123 mobile app. I know there is the PC app that allows you to create and publish your forms. Is there a PC application that will allow me to enter data similar to the mobile application?
... View more
12-07-2016
12:33 PM
|
0
|
3
|
1942
|
|
POST
|
Think i got it....used the Stream Segments as input to the Snap Pour Points and then rant he watershed...got this
... View more
12-06-2016
08:48 AM
|
0
|
0
|
3989
|
|
POST
|
I am not interested in super accurate results....I have attached an image of what I got when I ran the watershed tool with the Flow Direction and DEM as inputs. I need to create a boundary around streams that drain into them. From this boundary I need to get the area draining into the streams.... Thoughts?
... View more
12-06-2016
08:42 AM
|
0
|
1
|
3989
|
|
POST
|
Thanks for the response...I am good up to the Depressionless DEM...then get confused on which way to go... I have two locations along the stream that I want to reference and get the watershed/area upstream of those 2 points. Not sure if I need to do Flow Length or Snap Pour Point or both then use that output with the watershed tool....
... View more
12-06-2016
08:18 AM
|
0
|
3
|
3989
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|