JuliaPy / JuliaPy/PythonCall.jl

Conversion from Python datetime to Julia DateTime fails

Open
#265 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
1.1k
Forks
86
Avg merge
1d 22h
Merged PRs (30d)
3

Description

```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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.