How to install py.xml

5,183 views
Skip to first unread message

Satya Rao

unread,
May 25, 2017, 10:11:31 AM5/25/17
to Python Pune
I wanted to install py.xml plugin. How to do that? Because this is using in pytest-html.

Thanks,
Satya

Satya Rao

unread,
May 25, 2017, 10:14:26 AM5/25/17
to Python Pune
pip install py.xml says no packages found.

but in pytest-html they are importing this like below.
from py.xml import html

Abhijeet Kasurde

unread,
May 25, 2017, 11:04:58 AM5/25/17
to pytho...@googlegroups.com
Hi Satya,

I think you should look into this link -
http://pylib.readthedocs.io/en/stable/xml.html.
On installation page you will find details about installation using
source and pip.
Thanks and Regards,

Abhijeet Kasurde
Explore. Dream. Discover
> --
> You received this message because you are subscribed to the Google Groups
> "Python Pune" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pythonpune+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Satya Rao

unread,
May 26, 2017, 10:08:41 AM5/26/17
to Python Pune, abhijeet...@gmail.com
Thanks Abhijeet for your reply.
In the link that you have provided no where mentioned about how to install py.xml. And I couldn't find the installation page to install this. Could you please let me know exactly how to install this.

I am using windows 7 x64, and Python 2.7 (x64) version.

Thanks,
Satya.

Sachet Mittal

unread,
May 28, 2017, 11:31:43 AM5/28/17
to pytho...@googlegroups.com
Hi Satya

I am not sure if you are referring the same link or not but it is mentioned at  http://pylib.readthedocs.io/en/stable/install.html

easy_install -U py
(for pip example is not given but i assume it to be "pip install py")


Also could you not just install pytest-html and get  py.xml installed from it.
(I have installed pytest-html on ubuntu and was able to generate/modify html reports without any issues)

Regards,
Sachet Mittal


To unsubscribe from this group and stop receiving emails from it, send an email to pythonpune+unsubscribe@googlegroups.com.

Satya Rao

unread,
May 29, 2017, 3:07:25 AM5/29/17
to Python Pune
Hi Sachet Mittal,
 I have py installed already in my PC. But I didn't find the xml inside it, instead I have "_xmlgen". How do I get the xml stuff inside my py package?

Thanks,
Satya.

Abhijeet Kasurde

unread,
May 29, 2017, 5:09:33 AM5/29/17
to pytho...@googlegroups.com
Hi Satya,

Could you please paste exact error and Python version ? what do you
mean, you have "_xmlgen" ?

On my laptop, I am able to import py.xml using Sanchet's suggestion.

# python -c "import py.xml, sys;sys.exit('py.xml exists')"
py.xml exists


Thanks and Regards,

Abhijeet Kasurde
Explore. Dream. Discover


Sachet Mittal

unread,
May 29, 2017, 10:50:33 AM5/29/17
to pytho...@googlegroups.com
Thanks Abhijeet for validating this.
just a minor correction.

s/Sanchet/Sachet/

Also Satya, i think it would be better if you can explain what exactly is your requirement, is it installing pytest-html or py.xml?

Regards,
Sachet Mittal



> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Python Pune" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonpune+unsubscribe@googlegroups.com.

Abhijeet Kasurde

unread,
May 29, 2017, 11:11:25 AM5/29/17
to pytho...@googlegroups.com
On Mon, May 29, 2017 at 8:20 PM, Sachet Mittal <sachet...@gmail.com> wrote:
> Thanks Abhijeet for validating this.
> just a minor correction.
>
> s/Sanchet/Sachet/
>
I am so sorry, I don't mean to spell it wrong.

> Also Satya, i think it would be better if you can explain what exactly is
> your requirement, is it installing pytest-html or py.xml?
>
+1

Satya Rao

unread,
May 30, 2017, 1:00:23 AM5/30/17
to Python Pune
Hi Sachet & Abhijeet,
  I have run the command that Abhijeet suggested above and it says py.xml exists. But when I'm importing the py.xml in my conftest.py file it is showing error like unresolved import py.xml.

C:\Users\sgorle> python -c "import py.xml, sys;sys.exit('py.xml exists')"
py.xml exists

My requirement is I wanted to modify the html report that I have got by running my pytests. To do that I need to modify some of the html hooks in my conftest.py file. To do so I need py.xml as well. I just checked with the above command to check py.xml exists and it says that py.xml exists, but still I am unable to import this py.xml from any python module file.

And one more thing I couldn't find the xml under py folder in Lib/site_packages/py/ . Should xml be there to use it? Where this py.xml is installed?

I am using Python 2.7.13 (x64) on windows 7 x64.

Thanks,
Satya.

Sachet Mittal

unread,
May 30, 2017, 1:50:59 AM5/30/17
to pytho...@googlegroups.com
Hi Satya,

Thanks for explaining the requirement better.

Can you share your import statement. I suspect that there might be an issue there.

<snip>
In [1]: import py.xml

In [4]: import py.xml.html
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-2548f92976b0> in <module>()
----> 1 import py.xml.html

ImportError: No module named html

In [5]: from py.xml import html

In [6]: 
</snip>


if your imports work fine in python prompt it should work in the script as well.


To unsubscribe from this group and stop receiving emails from it, send an email to pythonpune+unsubscribe@googlegroups.com.

mahendra jadhav

unread,
May 30, 2017, 5:52:25 AM5/30/17
to pytho...@googlegroups.com

Just to add in to Sachet,
You need to import as following

from py.xml import html

As html is class and not module, check details using help(html)

Satya Rao

unread,
May 31, 2017, 7:19:49 AM5/31/17
to Python Pune
Hi Sachet,
  I have tried from python command prompt and it works fine.

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\sgorle>python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from py.xml import html
>>> import py.xml
>>>

But, when I am importing it from any file (conftest.py or some xyz.py), then my IDE (Eclipse with PyDev) showing Unresolved import error. Please check the screenshot below.



Thanks,
Satya.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonpune+...@googlegroups.com.

Sachet Mittal

unread,
Jun 7, 2017, 2:18:33 AM6/7/17
to pytho...@googlegroups.com
Hi Satya,

I have been pretty busy this last week so couldn't reply.
If you were able to proceed, then please ignore this mail.

This issue is not really with py-test html, this is a known issue with eclipse.
It doesn't get all the externally installed packages.
I tried using eclipse for a week and didn't like it that much, i would recommend changing your developer environment.

Did you try restarting eclipse?
or maybe the following links may provide some guidance:


Regards,
Sachet Mittal

To unsubscribe from this group and stop receiving emails from it, send an email to pythonpune+unsubscribe@googlegroups.com.

Satya Rao

unread,
Jun 7, 2017, 8:43:27 AM6/7/17
to Python Pune
Oh.ok, thanks Sachet. I will try this out and let you know.

Thanks,
Satya.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonpune+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages