Python Forum

Full Version: pyphs run error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
my question here
I recently installed pyphs package in python.
When I run the script, it shows import error: No module named phs


# inductor
inductor = {'dictionary': 'electronics',
           'component': 'inductor',
           'label': 'myL',
           'nodes': ('A', 'B'),
           'arguments': {'L': ('L1', 5e-2)}}
phs.graph.netlist.add_line(inductor)
Please, post the relevant code (in code tags)- i.e. in this code snippet there is no import statement, as well as full Traceback in error tags.
Sorry, for not providing full details,
I am trying to reproduce the example given in https://afalaize.github.io/pyphs/posts/inductor/

import pyphs
#inductor
inductor= {'dictionary':'electronics',
'component':'inductor',
'label':'myL',
'nodes':('A','B'),
'arguments':{'L':('L1',5e-2)}}
phs.graph.netlist.add_line(inductor)



the .net file is
electronics.inductor myL('A','B'):C=('L1',5e-2);


I am getting the error as

Traceback (most recent call last):
 File "script.py", line 8, in <module>
   phs.graph.netlist.add_line(inductor)
NameError: name 'phs' is not defined
(Jun-02-2017, 01:21 PM)pournamy Wrote: [ -> ]phs.graph.netlist.add_line(inductor)
My guess would be this should either be pyphs.phs.graph... or pyphs.graph...
I think you should start from here
https://afalaize.github.io/pyphs/posts/tuto1/
note the
phs = pyphs.PortHamiltonianObject(label='RLC', path='label')
When i am trying to do ,
phs=pyphs.PortHamiltonianObject(label='L', path='label')

I am getting an error as
AttributeError: 'module' object has no attribute 'PortHamiltonianObject'
(Jun-02-2017, 07:59 PM)pournamy Wrote: [ -> ]When i am trying to do ,
phs=pyphs.PortHamiltonianObject(label='L', path='label')

I am getting an error as

[output][AttributeError: 'module' object has no attribute 'PortHamiltonianObject'/output]