I run this python code and also import lxml library on windows using this:
Path > install setup.py
It successfully installed.
The code is:
from lxml import html
import requests
page = requests.get('http://econpy.pythonanywhere.com/ex/001.html')
tree = html.fromstring(page.text)
#This will create a list of buyers:
buyers = tree.xpath('//div[#title="buyer-name"]/text()')
#This will create a list of prices
prices = tree.xpath('//span[#class="item-price"]/text()')
print ('Buyers: ', buyers)
print ('Prices: ', prices)
But when i run this code the following error occurs:
ImportError: cannot import name 'html'
I have a Mac and am using the Anaconda distribution. When I tried to import HTML, I got an error:
>>> from html import HTML
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name HTML
I found the problem came from the fact that I had two html packages in my $HOME/anaconda/lib/python2.7/site-packages directory:
drwxr-xr-x 8 user.name staff 256 Feb 7 12:54 html/
drwxr-xr-x 9 user.name staff 288 Feb 26 14:15 html-1.16.dist-info/
-rw-r--r-- 1 user.name staff 19209 Feb 26 14:15 html.py
-rw-r--r-- 1 user.name staff 24206 Feb 26 14:15 html.pyc
The file html.py and the directory html-1.16.dist-info/ are the correct contents. I don't know how the html/ directory got there. I deleted `html/', so now I have:
drwxr-xr-x 9 user.name staff 288 Feb 26 14:15 html-1.16.dist-info/
-rw-r--r-- 1 user.name staff 19209 Feb 26 14:15 html.py
-rw-r--r-- 1 user.name staff 24206 Feb 26 14:15 html.pyc
The import statement works now:
>>> from html import HTML
>>>
You need to install html package...Check this url
https://pypi.python.org/pypi/html/
try
from html import *
it worked for me..
Related
I migrated the database from us-central1 to asia_southeast1. I'd like to deploy the security rule to the new database but it doesn't work. The followings are the steps I took and the result:
(The new db called abc-asia-db, the whole database URL is https://abc-asia-db.asia-southeast1.firebasedatabase.app/)
firebase target:apply database main abc-asia-db
In firebase.json Replace database script with the followings
"database":
[{"target": "main","rules": "database.rules.json"},
{"target": "other","rules": "other.rules.json"}]
firebase deploy --only database
Then, it shows the following error message:
Error: Failed to get instance details for instance: abc-asia-db. See firebase-debug.log for more details.
If I created the new database in us-central1, it works well. The security rule can be deployed successfully. However, if I create the new database in asia_southeast1, it doens't work.
I use Mac OS and can't find the debug.log in my computer. There are the only files in the folder.
drwxr-xr-x 19 xxx staff 608 Aug 27 13:16 ..
drwxr-xr-x 12 xxx staff 384 Oct 5 14:39 functions
-rw-r--r--# 1 xxx staff 644 Oct 5 15:41 database.rules.json
-rw-r--r--# 1 xxx staff 643 Oct 5 16:28 other.rules.json
-rw-r--r-- 1 xxx staff 382 Oct 5 16:47 .firebaserc
-rw-r--r-- 1 xxx staff 467 Oct 6 11:52 firebase.json
drwxr-xr-x 9 xxx staff 288 Oct 6 12:44 .
Your firebase.json is probably malformed. In the example they have only one rule file per database. In your example, I see a duplicate entry for the main database. Try using this firebase.json content as an example:
{
"database": [
{"target": "main", "rules": "database.rules.json"}
]
}
the code will not create the output 'imdiff' but instead will say it can't find imdiff.
dyn896-105:intro sophiejacobs$ pwd
/Users/sophiejacobs/Downloads/preCourse/intro
dyn896-105:intro sophiejacobs$ ls
LThal_mask_func.nii.gz filtered_func_data.nii.gz
LThal_mask_std.nii.gz highres.nii.gz
bighead.nii.gz image0.nii.gz
bvals image1.nii.gz
cst2standard_73_46_26.nii.gz newfmri.nii.gz
diffdata.nii.gz standard.nii.gz
egepi.nii.gz structural.nii.gz
egfmri.nii.gz sub3m0.nii.gz
example_func.nii.gz thresh_zstat1.nii.gz
example_func2highres.mat wrapped.nii.gz
example_func2standard.mat
dyn896-105:intro sophiejacobs$ fslmaths image0 -sub image1 imdiff
libc++abi.dylib: terminating with uncaught exception of type `enter code here`NiftiIO::NiftiException: Error: cant open file imdiff.nii.gz
Abort trap: 6
I expected that image1 would be subtracted from image0 and that that new image would be called imdiff
I think I had the same error and came across your post when trying to fix it
NBrMBP:intro colette$ fslmaths image0 -sub image1 imdiff
libc++abi.dylib: terminating with uncaught exception of type NiftiException: Error: cant open file imdiff.nii.gz
Luckily my supervisor was able to help.
I did not have permission to the directory/folders/files that I downloaded from the FSL tutorial website, but worked after I changed the permissions
cd to the folder that has the files you are trying to use (for me this was a folder called preCourse)
use the command: ls –la
This lists details of the files in the directory. In the left hand column it shows the permissions with dr-xr-xr-x# which means I only had permission to read the files.
e.g:
`NBrMBP:preCourse colette$ ls -la
total 16
dr-xr-xr-x# 3 colette staff 102 21 Jul 2017 fmri
dr-xr-xr-x# 23 colette staff 782 21 Jul 2017 intro`
Use the command: chmod u+w <directoryname>
Run this from the folder above the one you would need permissions from. (u=user w = writing permissions)
e.g NBrMBP:preCourse colette$ chmod u+w intro
Now use ls –la again, it should now show drwxr-xr-x# in the left hand column i
e.g.:
NBrMBP:preCourse colette$ ls -la
total 16
drwx------# 5 colette staff 170 8 Jan 11:55 .
drwxr-xr-x 4 colette staff 136 8 Jan 11:55 ..
-rw-r--r--# 1 colette staff 6148 8 Jan 11:55 .DS_Store
drwxr-xr-x# 3 colette staff 102 21 Jul 2017 fmri
drwxr-xr-x# 26 colette staff 884 8 Jan 15:51 intro
*Note you may need admin permissions on your computer to be able to change the permissions of the read/write/executability of the files.
Hope this helps anyone else who searched the error code!
I developed a C++ application that among others use SDL2.
It compiles and run on Ubuntu 18.04 (64 bit machine) and on OSX.
When I try to compile the application on a computer on chip running Ubuntu Mate 18.04 in a 32 bits machine with the libraries compiled by me, it returns an exception.
The exception is happening inside the line SDL_Init( SDL_INIT_VIDEO ) and the message is the following:
dbus[3856]: arguments to dbus_message_new_method_call were incorrect, assertion "path != NULL" failed in file ../../../dbus/dbus-message.c ine 1362.
This is normally a bug in some application using D-Bus library.
D-Bus not built with -rdynamic so unable to print backtrace.
Aborted
It seems a problem happening on Ubuntu running on a 32 bit machine. Have anyone had the same problem?
How can I solve this problem? Or does anyone know what is generating it?
NOTE 1
Running in gdb and using backtrace as suggested:
#0 0xb613d206 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
#1 0xb614ab32 in __libc_signal_restore_set (set=0xbeffe3a4) at ../sysdeps/unix/sysv/linux/nptl-signals.h:80
#2 0xb614ab32 in __GI_raise (sig=sig#entry=6) at ../sysdeps/unix/sysv/linux/raise.c:48
#3 0xb614b82e in __GI_abort () at abort.c:79
#4 0xb2adddf0 in _dbus_abort () at /lib/arm-linux-gnueabihf/libdbus-1.so.3
#5 0xb2ad7c5a in _dbus_warn_check_failed () at /lib/arm-linux-gnueabihf/libdbus-1.so.3
#6 0xb2ad8104 in _dbus_warn_return_if_fail () at /lib/arm-linux-gnueabihf/libdbus-1.so.3
#7 0xb2acce80 in dbus_message_new_method_call () at /lib/arm-linux-gnueabihf/libdbus-1.so.3
#8 0xb68acdba in () at /usr/lib/arm-linux-gnueabihf/libSDL2-2.0.so.0
NOTE 2
The same happens if I install SDL from the repository instead of building it.
I found a partial solution so anybody with a better one would be welcome.
As #Keltar suggested in the comment I debugged it with gdb and backtrace as already said in the question. The last line of backtrace got me suspicious:
#8 0xb68acdba in () at /usr/lib/arm-linux-gnueabihf/libSDL2-2.0.so.0
which suggested it is not taking the library built by me but the one installed with apt. I checked all the paths in Makefile and everything was pointing to my custom built. So I checked the dynamic library files *.so and I found the situation was the following:
drwxr-xr-x 3 odroid odroid 4096 Oct 15 12:21 cmake
lrwxrwxrwx 1 odroid odroid 17 Oct 15 12:21 libSDL2-2.0d.so -> libSDL2-2.0d.so.0
lrwxrwxrwx 1 odroid odroid 21 Oct 15 12:21 libSDL2-2.0d.so.0 -> libSDL2-2.0d.so.0.8.0
-rw-r--r-- 1 odroid odroid 4317020 Oct 15 12:21 libSDL2-2.0d.so.0.8.0
lrwxrwxrwx 1 odroid odroid 15 Oct 15 12:40 libSDL2-2.0.so -> libSDL2-2.0d.so
-rw-r--r-- 1 odroid odroid 7593354 Oct 15 12:21 libSDL2d.a
-rw-r--r-- 1 odroid odroid 4754 Oct 15 12:19 libSDL2maind.a
lrwxrwxrwx 1 odroid odroid 14 Oct 15 13:38 libSDL2.so -> libSDL2-2.0.so
drwxr-xr-x 2 odroid odroid 4096 Oct 15 12:21 pkgconfig
Note that for the symbolic link file libSDL2.so -> libSDL2-2.0.so, the linked file libSDL2-2.0.so was not created.
My solution was to rebuild the library in Release mode instead of Debug using cmake -DCMAKE_BUILD_TYPE=Release: in that way all the files library are correct. Another solution might be to symlink the file(s) manually but is is easy to mess up something.
So it seems a bug in how SDL cmake write the instructions for the Debug build type because in release mode my program run.
If anyone has a better solution or find any error that I could not find please let me know.
I want to install groovy on a unix server and test functionality. I used manual instructions from the following link:
https://itekblog.com/centos-groovy-installation-tutorial-newbs-centos-6-x/
I think the java jdk is installed, but im not certain since I didnt do it myself. I base my opinion on the following commands(i edited output with xxxs to obfuscate info):
[root#xxx groovy]# which java
/opt/xxx/xxx/bin/java
and
[root#xxx bin]# ll
total 48
lrwxrwxrwx. 1 root jdk8 29 Aug 10 2017 jar ->
/opt/xxx/jdk8/current/bin/jar
lrwxrwxrwx. 1 root jdk8 30 Aug 10 2017 java ->
/opt/xxx/jdk8/current/bin/java
lrwxrwxrwx. 1 root jdk8 29 Aug 10 2017 jps ->
/opt/xxx/jdk8/current/bin/jps
lrwxrwxrwx. 1 root jdk8 32 Aug 10 2017 jstack ->
/opt/xxx/jdk8/current/bin/jstack
lrwxrwxrwx. 1 root jdk8 31 Aug 10 2017 jstat ->
/opt/xxx/jdk8/current/bin/jstat
lrwxrwxrwx. 1 root jdk8 33 Aug 10 2017 keytool ->
/opt/xxx/jdk8/current/bin/keytool
Here is my bash_profile:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export GROOVY_HOME=/usr/groovy/groovy-2.5.1
PATH=$PATH:$HOME/bin:$GROOVY_HOME/bin
export PATH
I "reloaded" my profile:
source ~/.bash_profile
Here is what happens when I try to "run" groovy:
[root#lhost-cl2 groovy]# groovy -e 'println("Hello, World!")'
Exception in thread "main" java.lang.ClassFormatError:
org.codehaus.groovy.tools.GroovyStarter (unrecognized class file version)
at java.lang.VMClassLoader.defineClass(libgcj.so.10)
at java.lang.ClassLoader.defineClass(libgcj.so.10)
at java.security.SecureClassLoader.defineClass(libgcj.so.10)
at java.net.URLClassLoader.findClass(libgcj.so.10)
at java.lang.ClassLoader.loadClass(libgcj.so.10)
at java.lang.ClassLoader.loadClass(libgcj.so.10)
at gnu.java.lang.MainThread.run(libgcj.so.10)
Suggestions?
There were two versions of java installed on the server. The older version, not compatible with groovy, was being referenced. I updated the path and its happy now.
This might be simple problem. But I am stuck with this for weeks now.
We have an AIX server in which we are facing this issue. I am not able to run programs inside a specific directory and its sub directories.
I am getting proper outputs for commands java and scp2 in /opt/FileNet directory. But when I am in /opt/FileNet/RM directory these commands stops working. Outputs are as below.
Java - JVMXM008: Error occured while initialising System ClassException in thread "main" Could not create the Java virtual machine.
SCP2 - Failed to parse installation path.
I have no idea why this is happening. Your thoughts please.
drwxr-xr-x 24 root system 4096 Feb 21 2012 opt
drwxr-xr-x 17 jxadmin wasadmin 4096 Aug 14 08:40 FileNet
drwxrwxr-x 17 jxadmin wasadmin 4096 Aug 14 08:45 RM
drwxrwxr-x 37 jxadmin wasadmin 4096 Feb 13 2012 AE (/opt/FileNet/AE, This directory is working as expected)
Couldn't find any ACLs.