Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68610

Re: File Path/Global name issue

From Peter Otten <__peter__@web.de>
Subject Re: File Path/Global name issue
Date 2014-03-20 21:26 +0100
Organization None
References <2089d20b-aa60-462f-aad0-51109849cf36@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.8314.1395347194.18130.python-list@python.org> (permalink)

Show all headers | View raw


roy.snuffles@gmail.com wrote:

> I am currently running code for a program called HotNet
> (https://github.com/raphael-group/hotnet)
> 
> In its simpleRun.py file, there is a place to insert a file path to be
> run.
> 
> parser.add_argument('-mf', '--infmat_file', required=True,
>                         help='Path to .mat file containing influence
>                         matrix')
> 
> My path file is /home/lai/Downloads/influence_matrix_files/hprd_inf_.mat
> 
> And I have tried to add it in as such:
> 
> Input:
> 
> parser.add_argument('-mf', '--infmat_file', required=True,
>                    help=
>                    /home/lai/Downloads/influence_matrix_file/hprd_inf_.mat)
> 
> Output:
> 
> File "simpleRun.py", line 29
>     help= ~/home/lai/Downloads/influence_matrix_files/hprd_inf_.mat)
>            ^
> SyntaxError: invalid syntax
> 
> I have also tried to place the path in ' ' but that isn't processed.
> 
> I have tried removing the / however that just returns the following error:
> 
> NameError: global name 'home' is not defined
> 
> 
> Completely new at this, so thank you for bearing with me and for the help!

Reread the documentation, you are misunderstanding it. You don't have to 
modify the simpleRun.py script, you should invoke it from the commandline 
with the file as one of its arguments:

$ python simpleRun.py --infmat_file /home/lai/Downloads/influence_matrix_files/hprd_inf_.mat

As there are more required arguments you will end up with a very long 
command line. But there is an alternative. Create a config file like the 
following

https://github.com/raphael-group/hotnet/blob/master/example/configs/simple.config

where you replace all the file names with those of your actual files and 
then invoke simpleRun.py with

$ python simpleRun.py @roy_snuffles.config

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

File Path/Global name issue roy.snuffles@gmail.com - 2014-03-20 12:55 -0700
  Re: File Path/Global name issue Skip Montanaro <skip@pobox.com> - 2014-03-20 15:05 -0500
    Re: File Path/Global name issue roy.snuffles@gmail.com - 2014-03-20 13:08 -0700
      Re: File Path/Global name issue Skip Montanaro <skip@pobox.com> - 2014-03-20 15:15 -0500
  Re: File Path/Global name issue Peter Otten <__peter__@web.de> - 2014-03-20 21:26 +0100
  Re: File Path/Global name issue John Gordon <gordon@panix.com> - 2014-03-20 21:31 +0000

csiph-web