Solved

Macports Import Problem

Posted on 2016-07-29
4
59 Views
Last Modified: 2016-07-30
I am trying to import into MacPorts html5lib as you can see it is active

https://gyazo.com/dd71e7f3c075fe4bda9826e67db38eb5 and you can see the syntax I tried.  Please help me get this imported.

Thanks,
0
Comment
Question by:sharingsunshine
  • 2
4 Comments
 

Expert Comment

by:Kathy Rose
ID: 41735473
Python 2.7.3 (default, Jan 31 2013, 22:54:33)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scapy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named scapy
I have also tried with Python2.5, doesn't work either.

Python 2.5.6 (r256:88840, Aug  5 2011, 03:29:42)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scapy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named scapy
I think it has to do with the path somehow, but I don't know where to edit those on Mac, especially that I installed scapy from MacPorts.
0
 
LVL 39

Expert Comment

by:Eoin OSullivan
ID: 41735510
You seem to be running commands to install a macport package from inside the python x11 window which will not work.

Go back to your terminal window and enter the command and it will work fine
 sudo ports install py27-html5lib

Open in new window

0
 
LVL 39

Accepted Solution

by:
Eoin OSullivan earned 500 total points
ID: 41735663
Remember that the package on macports is called 'py27-html5lib' .. but once you have it installed when you are referring to it from python you use the package name which is simply 'html5lib'

So inside your python shell you'd type
import html5lib

Open in new window


In effect because you're using macports to install python and all the associated packages the names of the packages on MacPorts will might be a little different from the package itself.

if you're following that web tutorial on your previous question please bear in mind that anywhere it tells you to install a python package you need to tweak the URL and package name for macports but once installed the commands INSIDE the python shell will be the same as if you were using the default python installed with OSX
0
 

Author Closing Comment

by:sharingsunshine
ID: 41735726
thanks again, great help
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Swadhin
Introduction of Lists in Python: There are six built-in types of sequences. Lists and tuples are the most common one. In this article we will see how to use Lists in python and how we can utilize it while doing our own program. In general we can al…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question