JuliaPy / JuliaPy/PythonCall.jl

Conversion from Python datetime to Julia DateTime fails

Ouverte
#265 6 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
Julia
Étoiles
1.1k
Forks
86
Merge moyen
1 j 22 h
PR mergées (30 j)
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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
backend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.