» »

Težava pri importanju extruct modula v PyCharm

Težava pri importanju extruct modula v PyCharm

HotBurek ::

Dober dan.


Ima težavo z importanjem in uporabo extruct modula, a le v PyCharm-u.

Koda:

#!/usr/bin/python3.7
import extruct;
json = extruct.extract("lol");
print(json);


Error:
AttributeError: module 'extruct' has no attribute 'extract'


V terminalu dela bp:

root@debian:/# /usr/bin/python3.7
Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import extruct;
RDFLib Version: 5.0.0
>>> json = extruct.extract("lol");
>>> print (json);
{'microdata': [], 'json-ld': [], 'opengraph': [], 'microformat': [], 'rdfa': [],
'dublincore': [{'namespaces': {}, 'elements': [], 'terms': []}]}
>>>



What to do next?
root@debian:/# iptraf-ng
fatal: This program requires a screen size of at least 80 columns by 24 lines
Please resize your window

infiniteLoop ::

Preveri če PyCharm uporablja enak python kot terminal (verzija, lokacija, virtualenv).
None of us is as dumb as all of us.

HotBurek ::

Interpreter je isti.

Sedaj sem ugotovil še to, da v interactive mode dela, če pa poženem:

/usr/bin/python3.7 /path/to/some.py

Pa ne dela.
root@debian:/# iptraf-ng
fatal: This program requires a screen size of at least 80 columns by 24 lines
Please resize your window

HotBurek ::

Evo, rešil težavo.

Problem je bil v tem, da sem skripto, v kateri sem pisal program, poimenoval... well... extruct.py.

In posledično import taisto poimenovanega modula ni delal.
root@debian:/# iptraf-ng
fatal: This program requires a screen size of at least 80 columns by 24 lines
Please resize your window


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

Zanka z zajemanjem števk

Oddelek: Programiranje
61131 (816) misticnimrk
»

Postavitev mySQL

Oddelek: Programiranje
92231 (1809) M01O
»

Pošljite nam vašo najboljšo kodo

Oddelek: Programiranje
122177 (1422) AndrejO
»

Kako bi naredil program

Oddelek: Programiranje
221756 (1024) Spura
»

Python - pomoč (strani: 1 2 3 )

Oddelek: Programiranje
10318040 (8788) black ice

Več podobnih tem