I'm wondering if anyone can help me.

I don't know anything about python, but I have done some coding (javascript, PHP and a little bit of C) and I've just started my job and found out there is python installed on our server.

A couple of months ago we had the pstats function (or whatever its called) working and we were able to monitor the statics of our users through the url that was set up. However, it has now stopped working, well it might have stopped a few month ago but we stopped using it and would like to use it again.

We also have apache on the server, and I just recently (also a couple of month ago) re-installed our SSL certificate which required me to restart that service for the new certificate to be installed. Would that have affected the python or would they have nothing to do with each other?

If they have nothing to do with each other or even if they did, does anyone know how I can get the link back up and working again so we can monitor the statistics?

The link looked like http://pstats.mycompanywebsite.com.au

Any help would be great!!!!
Thanks

Welcome to the forum!
It will help you to read a book designed for people moving from other languages to Python.
Here: www.diveintopython.org

...

What does your pstat code look like? Do you know if it's still in a valid directory that apache can get to ?

That's the problem, I don't know where I can find the pstats code. I was just given the link and asked to fix it. Normally if it was something like www.mycompany.com.au/files/something.html - I would know to log on to my website then go to the folder files and then edit the something.html file.

However, because its http://pstats.mycompany.com.au i don't know where to look to find the pstats. Is there like a general path that it would be installed on my server? I found /usr/lib/python2.2/ and in there I have the following files pstats.py, pstats.pyo and pstats.pyc. When i opened them the only one that I could read was pstats.py but it didn't make sense to me. The other two files came up with symbols and you could see some text underneath but not enough to recognise what it is saying.

pstats.py, pstats.pyo and pstats.pyc

pstats.py is the pstats module.
.pyc and .pyo are byte code versions of the module. When a module is run Python interprets the code into byte-code. To speed up this process, the byte code is stored in the .pyc file so that it doesn't compile every time.

You need to figure out where the pstats stuff is. And are you sure it's worked before? Or are they asking you to start from scratch?

Either way, here's the pstats documentation

That's the problem, I don't know where I can find the pstats code. I was just given the link and asked to fix it. Normally if it was something like www.mycompany.com.au/files/something.html - I would know to log on to my website then go to the folder files and then edit the something.html file.

However, because its http://pstats.mycompany.com.au i don't know where to look to find the pstats. Is there like a general path that it would be installed on my server? I found /usr/lib/python2.2/ and in there I have the following files pstats.py, pstats.pyo and pstats.pyc. When i opened them the only one that I could read was pstats.py but it didn't make sense to me. The other two files came up with symbols and you could see some text underneath but not enough to recognise what it is saying.

Errrr...stop me if I'm stating the obvious, but if your domain is mycompany.com, and the subdomain is pstats.mycompany.com, "pstats" will be a folder in the main "www" directory of mycompany.com. www.pstats.mycompany.com will redirect/point to www.pstats.mycompany.com/index.html or index.php or index. whatever you normally use.

I'm assuming that the index page in that directory contains the python code to get and display the pstats output.

am I nuts? this seems like fairly basic web design.

PS: The term Python baby is strangely disturbing.

zachabesh - As far as I know if pstats was a folder in the main "www" directory the url would be mycompany.com/pstats/index.html. Ive ben doing web-design for a while now and never have come across with the folder being before the main url. Plus I've never worked with python before.

jlm699 - no they aren't asking me to start it from scratch, the boss said that it was working previously, because he was able to get the stats from the clients searching our website. I have gone through almost everything on the server, I just don't know what I'm looking for. I'll have a read through the documents and see if I can recognise anything. Is there like a special program that I can download that will help me read the python files?

Are the hosting servers yours or you are just hosting somewhere?
If you host yourself, just search for pstats.py as jlm699 suggests. Once you grab that you can know its location. If you use it from remote (i.e hosting somewhwere else) hopeful you will find an FTP program with search capabilities

Is there like a special program that I can download that will help me read the python files?

Python files are plain text. Use your favorite code editor to look at them.

And this is where apache's httpd.conf comes to the rescue.

cd /etc/httpd/conf
cat httpd.conf|grep pstats

This will give you the grep for the keyword pstats, and it will give you the static location of the files.

And now I'm also going to assume that you're running apache+mod_python as opposed to mod_wsgi
(Try grepping mod_python and mod_wsgi to see if you can find it)

If that still does not work then

cd /
find -name pstats

And these should be absolutely everything that you would need to do to find this dir.

After that: get the content of the (I'm guessing here) index.py file in that directory and paste it here so we can help you

And this is where apache's httpd.conf comes to the rescue.

cd /etc/httpd/conf
cat httpd.conf|grep pstats

This will give you the grep for the keyword pstats, and it will give you the static location of the files.

And now I'm also going to assume that you're running apache+mod_python as opposed to mod_wsgi
(Try grepping mod_python and mod_wsgi to see if you can find it)

If that still does not work then

cd /
find -name pstats

Thanks for the advice, but the grep came up with nothing, and even after a few "find -name"s trying different keywords like pstats or pstats.* or *.py I'm still coming up empty..

I even went through the whole httpd.conf and i've found that there are a few virtualhosts but no pstats or anything similar...

I'm really at a loss as to where to go with this and lets just say documentation wasn't my predicessor's favourite task...

Maybe I should mention that I found I have python2.2 and python 2.5 installed

I guess if the conf file doesn't contain it, that would explain why it no longer works... Without that info or a backed-up version of the file, or any body in your area that's has any idea about sys admin stuff, you're pretty much left with starting over from scratch.

Thanks for the advice, but the grep came up with nothing, and even after a few "find -name"s trying different keywords like pstats or pstats.* or *.py I'm still coming up empty..

I even went through the whole httpd.conf and i've found that there are a few virtualhosts but no pstats or anything similar...

I'm really at a loss as to where to go with this and lets just say documentation wasn't my predicessor's favourite task...

Well that seems to be it then. If the virtual host for pstats isn't found and your server runs on a apache backend then I guess the configuration that worked before has been over-written (Maybe by an upgrade of apache or through custom configurations). Anyways make sure to check all of the conf files for apache to see if you can find the pstats virtual host.

(Even if pstats is backproxied from another port, the virtualhost still must be configured first.)

Hope this helps.

I also have perl installed on the server which I also know nothing about. I probably will have to create another thread in the perl forum, but would pstats work with perl? I googled it but I don't know if what I read was right.

If it does I'll start another thread for Perl

Thanks everyone for all your help!!

Whether you implement pstats in python or perl you'll still have the same problem. You need to learn how to set up/maintain an apache server before you're ever going to get pstats.mycompany.com up and running again.

And no, pstats is a python module. But there are perl wrappers out there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.