pyMel bug? Could not create desired MFn - python

So when I call the nonLinear function with pymel and save it in a variable like this:
flare = pm.nonLinear(objName, type="flare")
and I want to get the name of the flare1 Input like this:
print flare[0]
I get this warning:
Warning: pymel.core.general : Could not create desired MFn. Defaulting to MFnDependencyNode.
Everything works fine and it doesn't break anything.
I have also searched for it but I didn't really get what the actual problem is or how to get rid of it.
Thanks to everyone looking into it.

Related

How to get partial match with soup.find()?

For some reason I wasn't able to find the answer to this somewhere.
So, I'm using this
soup.find(text="Dimensions").find_next().text
to grab the text after "Dimensions". My problem is on the website I'm scraping sometimes it is displayed as "Dimensions:" (with colon) or sometimes it has space "Dimensions " and my code throws an error. So that's why I'm looking for smth like (obviously, this is an invalid piece of code) to get a partial match:
soup.find(if "Dimensions" in text).find_next().text
How can I do that?
Ok, I've just found out looks like it's much simpler than I thought
soup.find(text=re.compile(r"Dimensions")).find_next().text
does what I need

How to use searchtype option in PubChemPy

I tried to run the code
pcp.get_compounds('CC', searchtype='superstructure', listkey_count=3)
but, it didn't work.
This code is exactly the same as one shown in the documentation ("https://pubchempy.readthedocs.io/en/latest/guide/searching.html#advanced-search-types").
Another code such as pcp.get_compounds('Aspirin', 'name', record_type='3d') which is shown in the same page worked.
Please give me some advice about how to fix this error.
It appears that the example in the PubChemPy advanced search documentation is missing a parameter. The example does not identify how to search, i.e., by SMILES. Substituting the following statement for the one in the example should give you the desired result.
pcp.get_compounds('CC', 'smiles', searchtype='superstructure', listkey_count=3)

how to get the return of pywhatkit.info() method into a variable

I am trying to get the output of the function into a variable instead of just putting it into the console
output = pywhatkit.info(search, lines=15)
but it is not working,
it just displays the texts in the cmd console instead of putting the result into the variable.
any kind of help is much appreciated
If you look at the source code, you could see that pywhatkit.info function is just delegating it's parameters to wikipedia.summary and displaying it's result to the console.
def info(topic,lines=3):
'''Gives information on a topic from wikipedia.'''
spe = wikipedia.summary(topic, sentences = lines)
print(spe)
So if you want to get the result of pywhatkit.info into a variable all you need to implement the following
output = wikipedia.summary(search, sentences=15)

How to access PyNode from a PyNode list?

I ran this example code with 2 polyCubes in scene.
import pymel.core as pymel
pymel.select('pCube1', 'blinn1')
print pymel.ls(sl = True)
print pymel.ls(sl = True)[0]
and this is my output
[nt.Transform(u'pCube1'), nt.Blinn(u'blinn1')]
pCube1
I know the elements inside this list are PyNodes, but printing them gives out a string type name of the node. Is there anyway to access the PyNode directly from this list?
Found the answer myself.
So apparently the Script Editor returns a representation of PyNode when we print it. Like it's an overloaded str. It is still a PyNode but looks like a string only in Maya's Script Editor. To make it actually appear like a PyNode, we have to use repr() or enclose in back-ticks (`)
Here is the link where I found the answer.
: http://download.autodesk.com/us/maya/2011help/pymel/tutorial.html
Formatting: Read Me First to Avoid Confusion section

global name 'find' is not defined

I am using a piece of code and am trying to debug it.
But something weird is happening.
In one part, I have this line:
vals = find(A)
But it gives me this error :
global name 'find' is not defined
I thought find was like an inbuilt function in python??
Clearly I am mistaken.
But just want to check.. in case I am forgetting to include anything.
find is a string method:
'python'.find('y') # gives 1
The real answer is:
look in this page:
http://docs.python.org/genindex.html
Why thinking to search with Google and not in an official doc ? Did you think that Python hadn't documentation ?

Categories