Skip to main content
edited body
Source Link
Andrew
  • 489
  • 6
  • 16

I am sure this is probably a simple syntax fix but I receive invalid syntax errors during the Select Analysis when trying to select records where the date field in my file geodb (ISS_CST) is greater than the date variable. I have tried a couple different lines but they do not work.

dayDateStr = '120521''120621'
dayDate10DaysAgo = datetime.datetime.strptime(dayDateStr, "%m%d%y") - timedelta(days=10)
print (dayDate10DaysAgo)
#arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo)
arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"")

>> 2021-11-26 00:00:00

File "weatherloader_Test_Warnings.py", line 279, in ProcessWarnings arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"") TypeError: cannot concatenate 'str' and 'datetime.datetime' objects

If I use the line currently commented out the error is:

File "weatherloader_Test_Warnings.py", line 278 arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo) ^ SyntaxError: invalid syntax

I am sure this is probably a simple syntax fix but I receive invalid syntax errors during the Select Analysis when trying to select records where the date field in my file geodb (ISS_CST) is greater than the date variable. I have tried a couple different lines but they do not work.

dayDateStr = '120521'
dayDate10DaysAgo = datetime.datetime.strptime(dayDateStr, "%m%d%y") - timedelta(days=10)
print (dayDate10DaysAgo)
#arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo)
arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"")

>> 2021-11-26 00:00:00

File "weatherloader_Test_Warnings.py", line 279, in ProcessWarnings arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"") TypeError: cannot concatenate 'str' and 'datetime.datetime' objects

If I use the line currently commented out the error is:

File "weatherloader_Test_Warnings.py", line 278 arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo) ^ SyntaxError: invalid syntax

I am sure this is probably a simple syntax fix but I receive invalid syntax errors during the Select Analysis when trying to select records where the date field in my file geodb (ISS_CST) is greater than the date variable. I have tried a couple different lines but they do not work.

dayDateStr = '120621'
dayDate10DaysAgo = datetime.datetime.strptime(dayDateStr, "%m%d%y") - timedelta(days=10)
print (dayDate10DaysAgo)
#arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo)
arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"")

>> 2021-11-26 00:00:00

File "weatherloader_Test_Warnings.py", line 279, in ProcessWarnings arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"") TypeError: cannot concatenate 'str' and 'datetime.datetime' objects

If I use the line currently commented out the error is:

File "weatherloader_Test_Warnings.py", line 278 arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo) ^ SyntaxError: invalid syntax

edited body
Source Link
Andrew
  • 489
  • 6
  • 16

I am sure this is probably a simple syntax fix but I receive invalid syntax errors during the Select Analysis when trying to select records where the date field in my file geodb (ISS_CST) is greater than the date variable. I have tried a couple different lines but they do not work.

dayDateStr = '120521'
print (dayDate10DaysAgo)
dayDate10DaysAgo = datetime.datetime.strptime(dayDateStr, "%m%d%y") - timedelta(days=10)
print (dayDate10DaysAgo)
#arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo)
arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"")

>> 2021-11-26 00:00:00

File "weatherloader_Test_Warnings.py", line 279, in ProcessWarnings arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"") TypeError: cannot concatenate 'str' and 'datetime.datetime' objects

If I use the line currently commented out the error is:

File "weatherloader_Test_Warnings.py", line 278 arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo) ^ SyntaxError: invalid syntax

I am sure this is probably a simple syntax fix but I receive invalid syntax errors during the Select Analysis when trying to select records where the date field in my file geodb (ISS_CST) is greater than the date variable. I have tried a couple different lines but they do not work.

dayDateStr = '120521'
print (dayDate10DaysAgo)
dayDate10DaysAgo = datetime.datetime.strptime(dayDateStr, "%m%d%y") - timedelta(days=10)
#arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo)
arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"")

>> 2021-11-26 00:00:00

I am sure this is probably a simple syntax fix but I receive invalid syntax errors during the Select Analysis when trying to select records where the date field in my file geodb (ISS_CST) is greater than the date variable. I have tried a couple different lines but they do not work.

dayDateStr = '120521'
dayDate10DaysAgo = datetime.datetime.strptime(dayDateStr, "%m%d%y") - timedelta(days=10)
print (dayDate10DaysAgo)
#arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo)
arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"")

>> 2021-11-26 00:00:00

File "weatherloader_Test_Warnings.py", line 279, in ProcessWarnings arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"") TypeError: cannot concatenate 'str' and 'datetime.datetime' objects

If I use the line currently commented out the error is:

File "weatherloader_Test_Warnings.py", line 278 arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo) ^ SyntaxError: invalid syntax

added 64 characters in body
Source Link
Andrew
  • 489
  • 6
  • 16

I am sure this is probably a simple syntax fix but I receive invalid syntax errors during the Select Analysis when trying to select records where the date field in my file geodbfile geodb (ISS_CST) is greater than the date variable. I have tried a couple different lines but they do not work.

dayDateStr = '120521'
print (dayDate10DaysAgo)
dayDate10DaysAgo = datetime.datetime.strptime(dayDateStr, "%m%d%y") - timedelta(days=10)
#arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo)
arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"")

>> 2021-11-26 00:00:00

I am sure this is probably a simple syntax fix but I receive invalid syntax errors during the Select Analysis when trying to select records where the date field in my file geodb (ISS_CST) is greater than the date variable. I have tried a couple different lines but they do not work.

dayDateStr = '120521'
dayDate10DaysAgo = datetime.datetime.strptime(dayDateStr, "%m%d%y") - timedelta(days=10)
#arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo)
arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"")

I am sure this is probably a simple syntax fix but I receive invalid syntax errors during the Select Analysis when trying to select records where the date field in my file geodb (ISS_CST) is greater than the date variable. I have tried a couple different lines but they do not work.

dayDateStr = '120521'
print (dayDate10DaysAgo)
dayDate10DaysAgo = datetime.datetime.strptime(dayDateStr, "%m%d%y") - timedelta(days=10)
#arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo)
arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"")

>> 2021-11-26 00:00:00
added 27 characters in body
Source Link
Andrew
  • 489
  • 6
  • 16
Loading
Source Link
Andrew
  • 489
  • 6
  • 16
Loading