bash: pyreport: command not found

Asked by Steeve

Bonjour,

J'ai fait un copier-coller du code source de pyreport.py (version 0.2.8) dans un fichier gedit que j'ai nommé pyreport.py et que j'ai sauvegarder dans mon dossier contenant tous mes programmes python. Dans la fenêtre de commande, lorsque j'effectue la commande suivante:

steeve@steeve-laptop:~/Documents/Python/euler$ ls
euler1.py euler2.py pyreport.py
steeve@steeve-laptop:~/Documents/Python/euler$ pyreport -t html euler1.py
bash: pyreport: command not found

Je ne comprends pas la raison pour laquelle il ne voit pas pyreport...

Un petit coup de main serait apprécier ;)

Beau petit programme en passant ;)

Question information

Language:
English Edit question
Status:
Solved
For:
pyreport Edit question
Assignee:
No assignee Edit question
Solved by:
Steeve
Solved:
Last query:
Last reply:
Revision history for this message
Gael Varoquaux (gael-varoquaux) said :
#1

Two things: first you need to make it executable (chmod uog+x pyreport.py). Second, if the file is named "pyreport.py", the bash command is "pyreport.py -t html ...", and not "pyreport -t ....".

Revision history for this message
Steeve (steevebrechmann-hotmail) said :
#2

Hi,

I try your advice, but didn't work either. I still have the bash: pyreport: command not found.
By the way, I'm on Ubuntu 8.04 and installed all i need to run your program (docutils).

steeve@steeve-laptop:~/Documents/Python/euler$ ls
euler1.py euler2.py pyreport.py
steeve@steeve-laptop:~/Documents/Python/euler$ chmod uog+x pyreport.py
steeve@steeve-laptop:~/Documents/Python/euler$ pyreport.py -t html euler1.py
bash: pyreport.py: command not found

Thanks for your time.

Steeve

Revision history for this message
Dariusz Suchojad (dsuch) said :
#3

Bash needs to know where to find the pyreport.py file, when you type "pyreport.py"
it scans all the directories pointed to by the $PATH environment variable and
tries to find "pyreport.py". Apparently, the directory you're typing "pyreport.py"
is not on the $PATH, so you should rather type "./pyreport.py" (note the ./ in front of pyreport.py)
to execute the file, meaning "run the pyreport.py file from the directory I'm currently in".

Revision history for this message
Steeve (steevebrechmann-hotmail) said :
#4

Hi dsuch,

I've tried your hint, it works so far, but pyreport always make a .tex file even if i put the -t html option...any ideas ?

steeve@steeve-laptop:~/Documents/Python/python-science$ ls
densities.py formulas_shapes.py hello_world.txt length_conversion.py onepone.txt sin2pcos2.txt
error_check.py formulas_shapes.txt interest_rate.py length_conversion.txt pyreport.py table.py
error_check.txt hello_world.py interest_rate.txt onepone.py sin2pcos2.py
steeve@steeve-laptop:~/Documents/Python/python-science$ ./pyreport.py -t html formulas_shapes.py
Running python script formulas_shapes.py:

The area of the parallelogram is 10.000

The area of the trapezoid is 14.25

The area of the circle is 7.069

The volume of the cone is 11.781

Done!

steeve@steeve-laptop:~/Documents/Python/python-science$ ls
densities.py formulas_shapes.py hello_world.py interest_rate.txt onepone.py sin2pcos2.py
error_check.py formulas_shapes.tex hello_world.txt length_conversion.py onepone.txt sin2pcos2.txt
error_check.txt formulas_shapes.txt interest_rate.py length_conversion.txt pyreport.py table.py

Thanks for your time !

Revision history for this message
Dariusz Suchojad (dsuch) said :
#5

I have no problems with generating the HTML output with pyreport 0.2.11.
What's your version? Can you look for __version__ inside the module (pyreport.py)?
Can you upload formulas_shapes.py somewhere so that I can try it myself?

Revision history for this message
Steeve (steevebrechmann-hotmail) said :
#6

Ok, I've used the 0.1.8 version...not the latest one. With the 0.2.11 all is cool. I haven't used this version because on the website, it says that there is a nasty bug in it...
Anyway, thanks for your help guys ! Very appreciated !

Keep the great work Gael.

Revision history for this message
Gael Varoquaux (gael-varoquaux) said :
#7

Hey guys,

I way away for a few days. Thanks a lot to Dsuch for the excellent answers.

@Steeve:
Yeah, sorry for the unhelpful message on the website about 0.2.11. I have more or less come to the conclusion that the approach used in pyreport was a fragile hack, and couldn't be robust. I also think I can have a robust approach, but I am so busy elsewhere I don't have time to implement it. It may happen sometime, though, as I might need this in my day work...