Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.7挂起获取约会项目的Outlook日历开始或结束属性_Python_Python 3.x_Outlook_Calendar - Fatal编程技术网

Python 3.7挂起获取约会项目的Outlook日历开始或结束属性

Python 3.7挂起获取约会项目的Outlook日历开始或结束属性,python,python-3.x,outlook,calendar,Python,Python 3.x,Outlook,Calendar,这段代码在Python 3.5.2中运行正常。在同一台机器里 在Python 3.7.0中,当您尝试获取约会属性开始或结束时,它会挂起。 它只在第一次请求开始或结束时挂起。没有出现错误消息 在Windows 10下测试,包括命令控制台和Jupyter笔记本 需要包括哪些建议或其他库 import win32com.client import datetime outlook = win32com.client.Dispatch("Outlook.Application").GetNamespa

这段代码在Python 3.5.2中运行正常。在同一台机器里

在Python 3.7.0中,当您尝试获取约会属性开始或结束时,它会挂起。 它只在第一次请求开始或结束时挂起。没有出现错误消息

在Windows 10下测试,包括命令控制台和Jupyter笔记本

需要包括哪些建议或其他库

import win32com.client
import datetime

outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
calendar = outlook.GetDefaultFolder(9)
appointments = calendar.Items
appointments.Sort("[Start]")
appointments.IncludeRecurrences = "True"

#This block restrict the time range. Doesn't change the hang up
begin = datetime.date(2018, 9, 1)  #year, month, day
end = datetime.date(2018, 10, 1)
print(f"Activities from: {begin}, to: {end}")
restriction = "[Start] >= '" + begin.strftime("%d/%m/%Y") + "' AND [End] <= '" +end.strftime("%d/%m/%Y") + "'"
print("restriction:", restriction)
restrictedItems = appointments.Restrict(restriction)

# The problem arise accessing as a unique item
appointment = restrictedItems[1]
print(appointment.Subject)
print(appointment.Organizer)
print(appointment.Start)
print(appointment.End)

# Also hangs up inside a loop of appointments
for appointment in restrictedItems:
    print(appointment.Subject)
    print(appointment.Organizer)
    print(appointment.Start)
    print(appointment.End)
导入win32com.client
导入日期时间
outlook=win32com.client.Dispatch(“outlook.Application”).GetNamespace(“MAPI”)
日历=outlook.GetDefaultFolder(9)
约会=日历。项目
约会。排序(“[开始]”)
appointments.includeCurrences=“True”
#此块限制时间范围。不会改变挂断状态
开始=日期时间。日期(2018年9月1日)#年、月、日
结束=日期时间。日期(2018年10月1日)
打印(f“活动从:{begin},到:{end}”)

restriction=“[Start]>=”+begin.strftime(“%d/%m/%Y”)+”和[End]对于Python 3.7.0,您需要使用pywin32 224(今天的最新版本)。
感谢Mark Hammond,他生成了这个新版本的pywin32,解决了这个问题。

对于Python 3.7.0,您需要使用pywin32 224(今天的最新版本)。
感谢Mark Hammond,他生成了这个新版本的pywin32,解决了这个问题。

也在Windows 7中进行了测试,结果与Python 3.7.0相似。您需要使用pywin32 224(或更高版本)。感谢Mark Hammond,他生成了这个新版本的pywin32,解决了这个问题。同样在Windows 7中进行了测试,结果与Python 3.7.0相似。您需要使用pywin32 224(或更高版本)。感谢Mark Hammond,他生成了这个新版本的pywin32,解决了这个问题。你能帮我解决这里的代码片段吗?你能帮我解决这里的代码片段吗?