Hi Dan,

Yes, I am able to reproduce the same problem using the command line if I 
invoke the csv_test.py script.

(venv) bash-5.0$ git status
On branch master
Your branch is up to date with 'upstream/master'.

nothing to commit, working tree clean

(venv) bash-5.0$ python beangulp/importers/csv_test.py 
Traceback (most recent call last):
  File "/home/picasso/src/beangulp/beangulp/importers/csv_test.py", line 9, 
in <module>
    from beancount.parser import cmptest
  File 
"/home/picasso/src/beangulp/venv/lib64/python3.9/site-packages/beancount/parser/cmptest.py",
 
line 10, in <module>
    import pytest
  File 
"/home/picasso/src/beangulp/venv/lib64/python3.9/site-packages/pytest/__init__.py",
 
line 3, in <module>
    from . import collect
  File 
"/home/picasso/src/beangulp/venv/lib64/python3.9/site-packages/pytest/collect.py",
 
line 8, in <module>
    from _pytest.deprecated import PYTEST_COLLECT_MODULE
  File 
"/home/picasso/src/beangulp/venv/lib64/python3.9/site-packages/_pytest/deprecated.py",
 
line 13, in <module>
    from _pytest.warning_types import PytestDeprecationWarning
  File 
"/home/picasso/src/beangulp/venv/lib64/python3.9/site-packages/_pytest/warning_types.py",
 
line 8, in <module>
    from _pytest.compat import final
  File 
"/home/picasso/src/beangulp/venv/lib64/python3.9/site-packages/_pytest/compat.py",
 
line 43, in <module>
    from importlib import metadata as importlib_metadata
  File "/usr/lib64/python3.9/importlib/metadata.py", line 5, in <module>
    import csv
  File "/home/picasso/src/beangulp/beangulp/importers/csv.py", line 110, in 
<module>
    class Importer(identifier.IdentifyMixin, filing.FilingMixin):
  File "/home/picasso/src/beangulp/beangulp/importers/csv.py", line 121, in 
Importer
    csv_dialect: Union[str, csv.Dialect] = 'excel',
AttributeError: partially initialized module 'csv' has no attribute 
'Dialect' (most likely due to a circular import)

(venv) bash-5.0$ pip freeze
astroid==2.5.2
attrs==20.3.0
beancount==3.0.0.dev0
beangulp==0.1.dev0
beautifulsoup4==4.9.3
cachetools==4.2.1
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
google-api-core==1.26.3
google-api-python-client==2.1.0
google-auth==1.28.0
google-auth-httplib2==0.1.0
googleapis-common-protos==1.53.0
httplib2==0.19.1
idna==2.10
iniconfig==1.1.1
isort==5.8.0
lazy-object-proxy==1.6.0
lxml==4.6.3
mccabe==0.6.1
packaging==20.9
pluggy==0.13.1
ply==3.11
protobuf==3.15.7
py==1.10.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pylint==2.7.4
pyparsing==2.4.7
pytest==6.2.3
python-dateutil==2.8.1
python-magic==0.4.22
pytz==2021.1
requests==2.25.1
rsa==4.7.2
six==1.15.0
soupsieve==2.2.1
toml==0.10.2
uritemplate==3.0.1
urllib3==1.26.4
wrapt==1.12.1

Kind regards,
Jakub.

On Sunday, 11 April 2021 at 22:45:25 UTC+1 dan...@grinta.net wrote:

> On 11/04/2021 23:43, Daniele Nicolodi wrote:
> > On 11/04/2021 23:16, kuba....@gmail.com wrote:
> >> Hi,
> >>
> >> I'm having some problems using the debugger in the beangulp project.
> >>
> >> I'm using PyCharm 2021.1.
> >> Python 3.9.2 (default, Feb 20 2021, 00:00:00) 
> >> [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
> >>
> >> When I run pytest normally everything runs fine, but if I try and use
> >> the debugger, the application bombs out with 
> >> AttributeError: partially initialized module 'csv' has no attribute
> >> 'Dialect' (most likely due to a circular import)
> >>
> >> My guess is that since the csv_importer was renamed to csv, the loader
> >> is getting confused with the importer module name and the csv python
> >> module. Given this only happens with the debugger, there must be some
> >> race condition. 
> >>
> >> When I have renamed the csv importer module name to something else, my
> >> problem is resolved.
> >>
> >> Any thoughts?
> > 
> > Can you reproduce the problem with anything else than PyCharm?
>
> Also, please note that the csv importer is in the
> beancount.ingest.importers.csv module in beancount v2, thus the rename
> is just bringing back the old module name and not something recent.
>
> Cheers,
> Dan
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/a142a6b1-1b1c-4cf3-80b8-9484096f8a3en%40googlegroups.com.

Reply via email to