JuliaPy / JuliaPy/PythonCall.jl

Conversion from Python datetime to Julia DateTime fails

未关闭
#265 6 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Julia
星标
1.1k
派生
86
平均合并
1 天 22 小时
30 天内合并 PR
3

描述

```Julia
using CondaPkg
using PythonCall
using Dates
datetime = pyimport("datetime")
t = datetime.datetime.now()
pyconvert(DateTime, t)
```
results in
```
cannot convert this Python 'datetime' to a Julia 'DateTime'

Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] macro expansion
@ ~/.julia/packages/PythonCall/3GRYN/src/convert.jl:355 [inlined]
[3] macro expansion
@ ~/.julia/packages/PythonCall/3GRYN/src/Py.jl:131 [inlined]
[4] pyconvert(#unused#::Type{DateTime}, x::Py)
@ PythonCall ~/.julia/packages/PythonCall/3GRYN/src/convert.jl:370
```
with the minimalist CondaPkg.toml
```
[deps]
python = "3.9"
```
but it fails with Python 3.10 and 3.11 too.

This is with CondaPkg v0.2.17 and PythonCall v0.9.10

贡献指南

这个仓库没有索引到贡献指南

调研方向

Start with the minimal Julia reproduction using CondaPkg and PythonCall, then inspect PythonCall's conversion path in src/convert.jl around line 355 and the pyconvert entry point shown in the stack trace. Check the behavior across the listed Python versions; done when a Python datetime converts successfully to Julia DateTime.

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。