Adding ALSA module in Python in Linux
221
Solution 1
It doesn't need to python setup.py build
, When you download by hand a module you should do it, however if you use install pip
system , you don't need to use the given command.
in debian-base systems you can see the following formula:
python-modulename #python2
python3-modulename #python3
But if you didn't find in debian repository, you can download by or without dowunlowd just use:
pip install yourmoudle
pip3 install yourmodule
before pip system programmers used easy_install
.
Solution 2
python-pyalsa is available in Debian for wheezy/testing/unstable. You don't need to build/install from source.
Related videos on Youtube
Author by
Jasper
Updated on September 18, 2022Comments
-
Jasper over 1 year
$links = $li->getElementsByTagName('a'); foreach ($links as $link) { $link_text = $link->nodeValue; $image = $dom->createElement('img'); $image->setAttribute('src', 'some target'); $image->setAttribute('alt', $link_text); $link->nodeValue($image); // doesnt work }
How do I replace link's nodevalue with the new one? (using domdocument)
There is actually one link inside li, but I'm not sure how to get it without foreach.
-
Felix Kling about 12 years
nodeValue
is actually not defined for elements. Don't know how PHP handles this though. -
Ignacio Vazquez-Abrams over 10 yearsYou don't need to do that. Read
INSTALL
again. -
Alen Milakovic over 10 years"I wanted to install ALSA inside my python". Sorry, I don't understand what this means. Can you clarify/elaborate?
-
-
Jasper about 12 yearsCatchable fatal error: Object of class DOMElement could not be converted to string
-
Jasper about 12 yearsCatchable fatal error: Object of class DOMElement could not be converted to string
-
Jasper about 12 yearsCatchable fatal error: Object of class DOMElement could not be converted to string
-
Casey Kinsey about 12 yearsI was just pointing out that it was a property, and not a method. The documentation should be able to shed some light on how to manipulate the library to work properly. Also, this error is coming up because you are apparently trying to assign an object ($image) to the property. It accepts a string only. You're probably wanting to insert an element, not alter the nodeValue.
-
Jasper about 12 yearsfor saveHtml- Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given
-
Jasper about 12 yearsI have to insert and replace nodeValue, there is a text, it should be replaced with the image. Have looked into docs, didnt find
-
cwallenpoole about 12 yearsThat is definitely a bizarre case and it goes directly against both experience and the docs, I would see if you have some sort of bizarre config issue if possible. You might also try saveXML. It should provide the same output in this case.
-
cwallenpoole about 12 yearsEither way, the correct way to do this is by using appendChild anyway.
-
Jasper about 12 yearssaveXML - Fatal error: Call to a member function saveXML() on a non-object
-
Casey Kinsey about 12 yearsAnd did you try $link->appendChild( $image ) ? That's the proper way to append a node to the li.
-
Jasper about 12 yearsok, if we appendchild, how do we remove the text node inside a link?
-
Casey Kinsey about 12 yearsYou may need to ammend that code to read $image->saveHTML(). OP, when you say it "doesn't work" what do you mean? Is there an error, or is the change not reflected in the document? Changes to the DomDocument object aren't reflected until you call saveHTML or saveXML and output the result.
-
cwallenpoole about 12 years@Steve There are "removeChild" and "replaceChild" methods and you can modify the textContent property. It is all found here.
-
Andrew Jessop almost 8 yearsI had the same problem on Ubuntu 14.04. To answer the original question, you also have to install the Python headers: sudo apt-get install libpython2.7-dev