[reportlab-users] platypus and xml.py
Jairo Souto
jsouto at gmx.com
Tue Sep 25 10:39:10 EDT 2018
thank you. i have to find the one who did this here.
i will have a lot of work to change the name xml.py :(
Robin Becker escreveu em Tue Sep 25 15:01:51 +0100 2018:
> Hi Jairo,
>
> I just tried this script in cwd
>
> >C:\code\hg-repos\reportlab\tmp>cat xml.py
> >import pdb;pdb.set_trace()
> >print('I am xml.py')
>
>
>
> with a late copy of reportlab and did not see xml imported in python27, however, I do see it when using python3.x.
> Obviously it's not intended that we import random scripts, but it does
> happen sometimes. In this case it seems as though the clash is caused by the
> standard library package xml which is triggered by an optional import of
> pyphen.
>
> So I can do this in python 3.7
>
> >C:\code\hg-repos\reportlab\tmp>\python37\python -c"import pyphen"
> > c:\code\hg-repos\reportlab\tmp\xml.py(2)<module>()
> >>print('I am xml.py')
> >Pdb) w
> > <string>(1)<module>()
> > <frozen importlib._bootstrap>(983)_find_and_load()
> > <frozen importlib._bootstrap>(967)_find_and_load_unlocked()
> > <frozen importlib._bootstrap>(677)_load_unlocked()
> > <frozen importlib._bootstrap_external>(728)exec_module()
> > <frozen importlib._bootstrap>(219)_call_with_frames_removed()
> > c:\python37\lib\site-packages\pyphen\__init__.py(45)<module>()
> >>from pkg_resources import resource_filename
> > <frozen importlib._bootstrap>(983)_find_and_load()
> > <frozen importlib._bootstrap>(967)_find_and_load_unlocked()
> > <frozen importlib._bootstrap>(677)_load_unlocked()
> > <frozen importlib._bootstrap_external>(728)exec_module()
> > <frozen importlib._bootstrap>(219)_call_with_frames_removed()
> > c:\python37\lib\site-packages\pkg_resources\__init__.py(35)<module>()
> >>import plistlib
> > <frozen importlib._bootstrap>(983)_find_and_load()
> > <frozen importlib._bootstrap>(967)_find_and_load_unlocked()
> > <frozen importlib._bootstrap>(677)_load_unlocked()
> > <frozen importlib._bootstrap_external>(728)exec_module()
> > <frozen importlib._bootstrap>(219)_call_with_frames_removed()
> > c:\python37\lib\plistlib.py(65)<module>()
> >>from xml.parsers.expat import ParserCreate
> > <frozen importlib._bootstrap>(983)_find_and_load()
> > <frozen importlib._bootstrap>(953)_find_and_load_unlocked()
> > <frozen importlib._bootstrap>(219)_call_with_frames_removed()
> > <frozen importlib._bootstrap>(983)_find_and_load()
> > <frozen importlib._bootstrap>(953)_find_and_load_unlocked()
> > <frozen importlib._bootstrap>(219)_call_with_frames_removed()
> > <frozen importlib._bootstrap>(983)_find_and_load()
> > <frozen importlib._bootstrap>(967)_find_and_load_unlocked()
> > <frozen importlib._bootstrap>(677)_load_unlocked()
> > <frozen importlib._bootstrap_external>(728)exec_module()
> > <frozen importlib._bootstrap>(219)_call_with_frames_removed()
> > c:\code\hg-repos\reportlab\tmp\xml.py(2)<module>()
> >>print('I am xml.py')
> >Pdb)
>
> it's a simple name clash; the answer is don't name your modules after a
> built in package or another well known module. You can run reportlab without
> pyphen, but there is always the chance that some other module in reportlab
> or another package will want to do something simple with xml. I have no idea
> why this problem doesn't occur with python 2.7.
>
>
> On 25/09/2018 14:25, Jairo Souto wrote:
> >a script xml.py in the working directory is run when importing platypus.
> >is it ok? why?
> >
> >===== xml.py :
> >
> >from dlg import spgsql
> >from lxml import etree
> >
> ...........
> >
> >===== typescript
> >
> >Script started on Tue Sep 25 10:16:19 2018
> >urano$ python3.6
> >Python 3.6.3 (default, Oct 13 2017, 23:01:18)
> >[GCC 4.2.1 20070719 ] on openbsd5
> >Type "help", "copyright", "credits" or "license" for more information.
> >>>>from reportlab import platypus
> ><Element {http://www.portalfiscal.inf.br/nfe}infNFe at 0x7f1bf9b7548>
> >AUTO PECAS NELSINHO LTDA
> >>>>
> >urano$ ^D
> >
> >Script done on Tue Sep 25 10:17:05 2018
> >
> >=====
> >
> >--Jairo Souto
> >
> >_______________________________________________
> >reportlab-users mailing list
> >reportlab-users at lists2.reportlab.com
> >https://pairlist2.pair.net/mailman/listinfo/reportlab-users
> >
>
>
> --
> Robin Becker
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
> https://pairlist2.pair.net/mailman/listinfo/reportlab-users
--Jairo Souto
More information about the reportlab-users
mailing list