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


Groups > comp.lang.python > #68610

Re: File Path/Global name issue

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'syntax': 0.04; 'insert': 0.05; 'error:': 0.07; 'modify': 0.07; 'arguments': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'url:github': 0.09; 'python': 0.11; 'arguments:': 0.16; 'commandline': 0.16; 'input:': 0.16; 'nameerror:': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'script,': 0.16; 'subject:File': 0.16; 'subject:issue': 0.16; 'syntaxerror:': 0.16; 'url:example': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'command': 0.22; 'header:User-Agent:1': 0.23; 'config': 0.24; 'replace': 0.24; 'help!': 0.26; 'subject:/': 0.26; 'defined': 0.27; 'header:X -Complaints-To:1': 0.27; 'tried': 0.27; 'code': 0.31; "skip:' 10": 0.31; 'invoke': 0.31; 'file': 0.32; 'running': 0.33; 'actual': 0.34; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'should': 0.36; 'thank': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'skip:- 10': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'called': 0.40; 'removing': 0.60; 'new': 0.61; 'email addr:gmail.com': 0.63; 'name': 0.63; 'more': 0.64; 'invalid': 0.68; 'containing': 0.69; 'influence': 0.74; 'alternative.': 0.84; 'url:config': 0.84; 'url:master': 0.84; 'subject:Global': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: File Path/Global name issue
Date Thu, 20 Mar 2014 21:26:21 +0100
Organization None
References <2089d20b-aa60-462f-aad0-51109849cf36@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p57bdb635.dip0.t-ipconnect.de
User-Agent KNode/4.11.5
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8314.1395347194.18130.python-list@python.org> (permalink)
Lines 56
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1395347195 news.xs4all.nl 2905 [2001:888:2000:d::a6]:41107
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:68610

Show key headers only | 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