atomhym / namebench

Automatically exported from code.google.com/p/namebench
0 stars 0 forks source link

Commandline version can't handle tilde as short for home in output target #120

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Grab revision 847 from svn
2. Use the commandline with  a tilde in the output file, like this : --
output=~/public_html/namebench.html
3. Crash on writing output !
4. The workaround is to use the full path for output.

Please provide any additional information below.

This is the error message :
- Saving HTML report to ~/public_html/namebench.html
Traceback (most recent call last):
  File "./namebench.py", line 78, in <module>
    namebench.Execute()
  File "/home/jvhaarst/bin/scripts/namebench-read-only/libnamebench/cli.py", line 125, in 
Execute
    self.RunAndOpenReports()
  File "/home/jvhaarst/bin/scripts/namebench-read-only/libnamebench/cli.py", line 97, in 
RunAndOpenReports
    self.CreateReports()
  File "/home/jvhaarst/bin/scripts/namebench-read-only/libnamebench/base_ui.py", line 190, in 
CreateReports
    f = open(self.html_path, 'w')
IOError: [Errno 2] No such file or directory: '~/public_html/namebench.html'

Original issue reported on code.google.com by jvhaa...@gmail.com on 16 May 2010 at 8:46

GoogleCodeExporter commented 8 years ago
tilde expansion is the responsibility of your shell. If you want the expansion 
to work properly, use a space 
instead of an equal sign:

--output ~/public_html/namebench.html

Alternatively, you can use $HOME instead of ~, which works anywhere.

Original comment by helixblue on 16 May 2010 at 9:43

GoogleCodeExporter commented 8 years ago
It could be handled by the shell, but more users will be bitten by this, beside 
me.
Simple solution : http://docs.python.org/library/os.path.html?
highlight=tilde#os.path.expanduser

Original comment by jvhaa...@gmail.com on 17 May 2010 at 7:26

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r850.

Original comment by thomas.r...@gmail.com on 17 May 2010 at 12:23

GoogleCodeExporter commented 8 years ago
Thanks for the tip! I've implemented your request in the trunk. Cheers!

Original comment by helixblue on 17 May 2010 at 12:23