Solved

Macports Import Problem

Posted on 2016-07-29
4
50 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Variable is a place holder or reserved memory locations to store any value. Which means whenever we create a variable, indirectly we are reserving some space in the memory. The interpreter assigns or allocates some space in the memory based on the d…
Sequence is something that used to store data in it in very simple words. Let us just create a list first. To create a list first of all we need to give a name to our list which I have taken as “COURSE” followed by equals sign and finally enclosed …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now