[CIG-SHORT] Error on running .cfg files

Mahesh Singh Dhar (msdhar) msdhar at memphis.edu
Fri Feb 17 12:12:06 PST 2012


Hi Brad,

My system administrator changed tcsh to bash. now it's good with $SHELL
-----------------------------
bash-3.2$ echo $0
/bin/bash
bash-3.2$ echo $SHELL
/bin/bash
---------------------------------

With this also same error message appeared. 

Then using "which" command as you indicated in your previous email, appeared as 


---------------------------------------------------
bash-3.2$ source setup.sh
Ready to run PyLith.
bash-3.2$ which python
/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/bin/python
bash-3.2$ python
'import site' failed; use -v for traceback                                        ----------  this is an extra line than yours--------
Python 2.6.6 (r266:84292, Jun 18 2011, 09:44:38) 
[GCC 4.6.0] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D    
bash-3.2$ which nemesis
/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/bin/nemesis
bash-3.2$ nemesis
'import site' failed; use -v for traceback                                 -------------- ----------  this is an extra line than yours--------
Python 2.6.6 (r266:84292, Jun 18 2011, 09:44:38) 
[GCC 4.6.0] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>>
bash-3.2$ which pylith
/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/bin/pylith
bash-3.2$ pylith
'import site' failed; use -v for traceback                                  ---------------------      ------------ ----------  this is an extra line than yours--------
Traceback (most recent call last):
  File "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/bin/pylith", line 28, in <module>
    import os.path, sys, site
File "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site-packages/site.py", line 73, in <module>
    __boot()
  File "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site-packages/site.py", line 33, in __boot
    imp.load_module('site',stream,path,descr)
  File "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py", line 525, in <module>
    main()
  File "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py", line 508, in main
    known_paths = addsitepackages(known_paths)
  File "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py", line 288, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py", line 185, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py", line 159, in addpackage
    if not dircase in known_paths and os.path.exists(dir):
  File "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/genericpath.py", line 18, in exists
    st = os.stat(path)
TypeError: stat() argument 1 must be encoded string without NULL bytes, not str
bash-3.2$ 



--------------------------------------------------------------------------------------------------------

I think now the environment problem is solved. Does the line  ('import site' failed; use -v for traceback) indicating any source of error? or is there still environment problem?
note: pylith-1.6.2-darwin-10.6.8 is a folder which contains setup.sh file.


sincerely,

mahesh


________________________________________
From: Brad Aagaard [baagaard at usgs.gov]
Sent: Friday, February 17, 2012 11:49 AM
To: Mahesh Singh Dhar (msdhar)
Cc: cig-short at geodynamics.org; olboyd at usgs.gov
Subject: Re: [CIG-SHORT] Error on running .cfg files

Mahesh,

Because your default shell is tcsh ($SHELL == /bin/tcsh), you will need
to startup a bash shell before running PyLith. So your typical workflow
will be

bash
cd DIRECTORY_WHERE_PYLITH_IS_INSTALLED
source setup.sh
RUN_PYLITH

In order to verify that your environment is setup properly after running
setup.sh, please try this:

bash
cd DIRECTORY_WHERE_PYLITH_IS_INSTALLED
source setup.sh
which python
which nemesis
which pylith
python [exit python shell by typing CONTROL-D]
nemesis [exit python shell by typing CONTROL-D]
pylith

When I do this with the v1.6.2 binary I get:

brad at arling$ source setup.sh
Ready to run PyLith.

brad at arling$ which python
/tools/common/pylith-dev/releases/v1.6.2/pylith-1.6.2-linux-x86_64/bin/python

brad at arling$ which nemesis
/tools/common/pylith-dev/releases/v1.6.2/pylith-1.6.2-linux-x86_64/bin/nemesis

brad at arling$ which pylith
/tools/common/pylith-dev/releases/v1.6.2/pylith-1.6.2-linux-x86_64/bin/pylith

brad at arling$ python
Python 2.6.6 (r266:84292, Mar  8 2011, 04:12:50)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>>

brad at arling$ nemesis
Python 2.6.6 (r266:84292, Mar  8 2011, 04:12:50)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>>

brad at arling$ pylith
--- LOTS OF STUFF ---
     raise ValueError("Filename for ASCII input mesh not specified.")
ValueError: Filename for ASCII input mesh not specified.


If you don't get similar results when you do "which python", "which
nemesis", or "which pylith", then your shell environment is not setup
correctly and we can't offer much assistance. If this happens, I
recommend switching your environment to the bash shell (ask your system
administrator for help), which is now the default shell on most unix
systems.

Regards,
Brad


On 02/17/2012 09:24 AM, Mahesh Singh Dhar (msdhar) wrote:
> Hi,
>
> Default shell environment in my lab is tcsh. As your suggestion I typed "bash" and followed your steps and after running " pylith axialdisp.cfg" , then again similar error appeared as previous one.
>
> Just for information;
> echo $SHELL gives tcsh and
> echo $0          gives bash
>
> -----------------------------------------------------------
> ceriml09:~ msdhar$ echo $SHELL
> /bin/tcsh
> ceriml09:~ msdhar$ bash
> bash-3.2$ echo $SHELL
> /bin/tcsh
> bash-3.2$ echo $0
> bash
> bash-3.2$
> --------------------------------------------------------------
>
> Does it make any difference?
>
> and I did unset PYTHOPATH also and after running pylith same error message appeared.
>
> I am looking forward for your suggestion.
>
> sincerely,
>
> Mahesh Singh Dhar
> Graduate Research Assistant
> CERI/University of Memphis
>
> ________________________________________
>
>
> On 2/10/12 3:34 PM, "Brad Aagaard"<baagaard at usgs.gov>  wrote:
>
>> On 02/10/2012 01:15 PM, Mahesh S Dhar wrote:
>>> Hi,
>>> I installed Pylith software  (using the link;
>>> pylith-1.6.2-darwin-10.6.8.tgz) and ran set up file by source setup.sh.
>> > From tutorial file I tried to run .cfg file ( e.g.  pylith
>>> axialdisp.cfg). the error message comes as below;
>>> ceriml09:pylith-1.6.2-darwin-10.6.8 msdhar$ source setup.sh Ready to
>>> run PyLith.ceriml09:pylith-1.6.2-darwin-10.6.8 msdhar$ cd ssetup.sh
>>> share/    src/      ceriml09:pylith-1.6.2-darwin-10.6.8 msdhar$ cd
>>> src/pylith/examples/twocells/twot twotet4/         twotet4-geoproj/
>>> twotri3/         ceriml09:pylith-1.6.2-darwin-10.6.8 msdhar$ cd
>>> src/pylith/examples/twocells/twotri3/ceriml09:twotri3 msdhar$ pylith
>>> axialdisp.cfg 'import site' failed; use -v for tracebackTraceback (most
>>> recent call last):  File
>>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/bin/pylith", line
>>> 28, in<module>      import os.path, sys, site  File
>>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site-p
>>> ackages/site.py", line 73, in<module>      __boot()  File
>>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site-p
>>> ackages/site.py", line 33, in __boot
>>> imp.load_module('site',stream,path,descr)  File
>>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.
>> py", line 525, in<module>      main()  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 508, in main    known_paths = addsitepackages(known_paths)  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 288, in addsitepackages    addsitedir(sitedir, known_paths)  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 185, in addsitedir    addpackage(sitedir, name, known_paths)
>> File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 159, in addpackage    if not dircase in known_paths and
>> os.path.exists(dir):  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/generic
>> path.py", line 18, in exists    st = os.stat(path)TypeError: stat()
>> argument 1 must be encoded string without NULL bytes, not
>> strceriml09:twotri3 msdhar$ pysetReady to run
>> PyLith.ceriml09:pylith-1.6.2-darwin-10.6.8 msdhar$ pylith
>> axialdisp.cfg'import site' failed;
>> use -v for tracebackTraceback (most recent call last):  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/bin/pylith", line
>> 28, in<module>      import os.path, sys, site  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site-pa
>> ckages/site.py", line 73, in<module>      __boot()  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site-pa
>> ckages/site.py", line 33, in __boot
>> imp.load_module('site',stream,path,descr)  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 525, in<module>      main()  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 508, in main    known_paths = addsitepackages(known_paths)  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 288, in addsitepackages    addsitedir(sitedir, known_paths)  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 185, in addsitedir    a
>> ddpackage(sitedir, name, known_paths)  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 159, in addpackage    if not dircase in known_paths and
>> os.path.exists(dir):  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/generic
>> path.py", line 18, in exists    st = os.stat(path)TypeError: stat()
>> argument 1 must be encoded string without NULL bytes, not
>> strceriml09:pylith-1.6.2-darwin-10.6.8 msdhar$ cd
>> src/pylith/examples/twocells/twotri3/ceriml09:twotri3 msdhar$ pylith
>> axialdisp.cfg'import site' failed; use -v for tracebackTraceback (most
>> recent call last):  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/bin/pylith", line
>> 28, in<module>      import os.path, sys, site  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site-pa
>> ckages/site.py", line 73, in<module>      __boot()  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site-pa
>> ckages/site.py", line 33, in __boot    i
>> mp.load_module('site',stream,path,descr)  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 525, in<module>      main()  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 508, in main    known_paths = addsitepackages(known_paths)  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 288, in addsitepackages    addsitedir(sitedir, known_paths)  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 185, in addsitedir    addpackage(sitedir, name, known_paths)
>> File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/site.py
>> ", line 159, in addpackage    if not dircase in known_paths and
>> os.path.exists(dir):  File
>> "/gaia/home/msdhar/pylith/pylith-1.6.2-darwin-10.6.8/lib/python2.6/generic
>> path.py", line 18, in exists    st = os.stat(path)TypeError: stat()
>> argument 1 must be encoded string without NULL bytes, not
>> strceriml09:twotri3
>> msdhar$
>>> How do I fix this? I am using MAC OS X Version 10.6.8.
>>>    sincerely,mahesh
>>
>> The error you are getting is likely caused by conflicts in your
>> environment setup. First, make sure you are using the bash shell.
>>
>> echo $SHELL
>>
>> The output should be "/bin/bash". If the output is not /bin/bash, then
>> simply startup a bash shell before running "source setup.sh" by typing
>> "bash". If you are using the bash shell, then please try the following
>>from the top-level pylith directory (where setup.sh) is:
>>
>> unset PYTHONPATH
>> unset DYLD_LIBRARY_PATH
>> PATH=/bin:/usr/bin
>> source setup.sh
>> cd src/pylith/examples/twocells/twotri3
>> pylith axialdisp.cfg
>>
>> Regards,
>> Brad
>> _______________________________________________
>> CIG-SHORT mailing list
>> CIG-SHORT at geodynamics.org
>> http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short
>
>
>
>
>





More information about the CIG-SHORT mailing list