Import Error: Failing to import file for classes that I've defined.
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, python
- Área
- compilers
Línea de trabajo
Reproduce the issue with transcrypt -v -n bezoar_sample.__main__ using the linked bezoar project and inspect the import chain ending at bezoar/model/relationship_declaration.py. Start with org/transcrypt/compiler.py, especially the visit_ClassDef area mentioned in the traceback, and compare the handling of entity.Entity with the related collections.abc import. Done means the sample imports compile without the reported missing-module errors and the regression is covered by a test.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Details
OS: Windows 10
Python Version: 3.9.6
Transcrypt version: 3.9.0
Summary
I'm trying to get my pure-Python project with no dependencies to be Transcrypt compatible, but ran into a problem very early with Import Errors for things that I don't understand. Specifically, names of functions or classes I'm importing are being reported as missing module files (examples below).
Steps to Reproduce
git clone https://gitlab.com/iffyb/bezoar.gittranscrypt -v -n bezoar_sample.__main__
Expected Results
It would import the function get_version and classes Entity and Player the way CPython does?
Actual Results
org.transcrypt.utils.Error: Error while compiling (offending file last):
File 'C:/cygwin/home/iffy/ws/bezoar/bezoar_sample/__main__.py', line 5, at import of:
File 'C:/cygwin/home/iffy/ws/bezoar/bezoar_sample/model.py', line 10, at import of:
File 'C:/cygwin/home/iffy/ws/bezoar/bezoar/model/__init__.py', line 29, at import of:
File 'C:/cygwin/home/iffy/ws/bezoar/bezoar/model/version_declaration.py', line 3, at import of:
File 'C:/cygwin/home/iffy/ws/bezoar/bezoar/model/player_declaration.py', line 6, at import of:
File 'bezoar.model.relationship_declaration', line 0, namely:
Import error, can't find any of:
C:/cygwin/home/iffy/ws/bezoar/bezoar/model/Entity.py
C:/cygwin/home/iffy/ws/bezoar/bezoar/model/Entity.js
c:/python/python39/lib/site-packages/transcrypt/modules/bezoar/model/Entity.py
c:/python/python39/lib/site-packages/transcrypt/modules/bezoar/model/Entity.js
C:/Python/Python39/Scripts/transcrypt.exe/bezoar/model/Entity.py
C:/Python/Python39/Scripts/transcrypt.exe/bezoar/model/Entity.js
C:/Users/iffy/AppData/Roaming/Python/Python39/site-packages/bezoar/model/Entity.py
C:/Users/iffy/AppData/Roaming/Python/Python39/site-packages/bezoar/model/Entity.js
c:/python/python39/lib/site-packages/bezoar/model/Entity.py
c:/python/python39/lib/site-packages/bezoar/model/Entity.js
bezoar.model is a package, and Entity is a class defined in the bezoar.model.entity_declaration module, which has a file in C:/cygwin/home/iffy/ws/bezoar/bezoar/model/entity_declaration.py.
relationship_declaration imports bezoar.model.entity_declaration as entity and refers to entity.Entity, among several other symbols in the bezoar.model.entity_declaration module that it doesn't complain about.
Full transcript here: transcrypt_transcript.txt
Other Notes
- It spits out many different Import Errors, some of them seemingly the same.
- There's another internal except in the log, not sure how relevant it is:
During handling of the above exception, another exception occurred: Traceback (most recent call last): File "c:\python/python39/lib/site-packages/transcrypt/modules\org\transcrypt\compiler.py", line 2028, in visit_ClassDef self.visit (statement.value) File "c:\python/python39/lib/site-packages/transcrypt/modules\org\transcrypt\compiler.py", line 985, in visit super () .visit (node) File "c:\python/python39/lib\ast.py", line 407, in visit return visitor(node) File "c:\python/python39/lib\ast.py", line 411, in generic_visit for field, value in iter_fields(node): File "c:\python/python39/lib\ast.py", line 249, in iter_fields for field in node._fields: AttributeError: 'NoneType' object has no attribute '_fields' - The line number reported is "line 0" which seems odd.
- There's also a similar-looking import error for
from collections.abc import MutableMappinginbezoar.base.overlay_mapping
- Lenguaje dominante
- Python
- Estrellas
- 2.9k
- Forks
- 218
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TranscryptOrg/Transcrypt
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
TranscryptOrg/Transcrypt#913 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
TranscryptOrg/Transcrypt#911 · 2 comentarios ·
-
IS: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
TranscryptOrg/Transcrypt#908 ·
-
SUB: documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
TranscryptOrg/Transcrypt#656 · 7 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 76/100
TranscryptOrg/Transcrypt#914 ·
Todos los issues de TranscryptOrg/Transcrypt
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
zostera/django-bootstrap4#894 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
use-agent-os/agent-os#3276 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
NousResearch/hermes-agent#117848 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
zilliztech/memsearch#759 ·