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.

Share:
221

Related videos on Youtube

Jasper
Author by

Jasper

Updated on September 18, 2022

Comments

  • Jasper
    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
      Felix Kling about 12 years
      nodeValue is actually not defined for elements. Don't know how PHP handles this though.
    • Ignacio Vazquez-Abrams
      Ignacio Vazquez-Abrams over 10 years
      You don't need to do that. Read INSTALL again.
    • Alen Milakovic
      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
    Jasper about 12 years
    Catchable fatal error: Object of class DOMElement could not be converted to string
  • Jasper
    Jasper about 12 years
    Catchable fatal error: Object of class DOMElement could not be converted to string
  • Jasper
    Jasper about 12 years
    Catchable fatal error: Object of class DOMElement could not be converted to string
  • Casey Kinsey
    Casey Kinsey about 12 years
    I 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
    Jasper about 12 years
    for saveHtml- Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given
  • Jasper
    Jasper about 12 years
    I have to insert and replace nodeValue, there is a text, it should be replaced with the image. Have looked into docs, didnt find
  • cwallenpoole
    cwallenpoole about 12 years
    That 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
    cwallenpoole about 12 years
    Either way, the correct way to do this is by using appendChild anyway.
  • Jasper
    Jasper about 12 years
    saveXML - Fatal error: Call to a member function saveXML() on a non-object
  • Casey Kinsey
    Casey Kinsey about 12 years
    And did you try $link->appendChild( $image ) ? That's the proper way to append a node to the li.
  • Jasper
    Jasper about 12 years
    ok, if we appendchild, how do we remove the text node inside a link?
  • Casey Kinsey
    Casey Kinsey about 12 years
    You 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
    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
    Andrew Jessop almost 8 years
    I 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