System : XP, work with python 2.7
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import json
File "C:\Python27\ArcGIS10.1\lib\json\__init__.py", line 108, in <module>
from .decoder import JSONDecoder
File "C:\Python27\ArcGIS10.1\lib\json\decoder.py", line 7, in <module>
from json import scanner
ImportError: cannot import name scanner
Anyone can explain me how to manage this error please ???
this morning I haven't got this problem, but this afternoon my script won't work ((
I think this is caused by relative import path,
File "C:\Python27\ArcGIS10.1\lib\json\decoder.py", line 7,
from json import scanner
it's trying to import scanner from
C:\Python27\ArcGIS10.1\lib\json
Related
I would like to use the cryptography's module on Windows, I am using version 1.12 and Python 3.10.6, and I have some problems. Actually, when I run my script, I receive the error :
`
Traceback (most recent call last):
File "C:/Users/edoua/Documents/cryptographie.py", line 1, in <module>
from cryptography.fernet import Fernet
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\fernet.py", line 16, in <module>
from cryptography.hazmat.primitives.hmac import HMAC
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\hazmat\primitives\hmac.py", line 10, in <module>
from cryptography.hazmat.backends.openssl.hmac import _HMACContext
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\hazmat\backends\openssl\__init__.py", line 6, in <module>
from cryptography.hazmat.backends.openssl.backend import backend
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 13, in <module>
from cryptography import utils, x509
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\x509\__init__.py", line 7, in <module>
from cryptography.x509.base import (
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\x509\base.py", line 28, in <module>
from cryptography.x509.extensions import (
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\x509\extensions.py", line 25, in <module>
from cryptography.x509.general_name import (
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptography\x509\general_name.py", line 9, in <module>
from email.utils import parseaddr
File "C:\Users/edoua/Documents\email.py", line 18, in <module>
server.login(email_address, email_password)
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 739, in login
(code, resp) = self.auth(
File "C:\Users\edoua\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 641, in auth
response = encode_base64(initial_response.encode('ascii'), eol='')
NameError: name 'encode_base64' is not defined
`
It is coming from the smtplib.py file. Also, I precise that the module works perfectly, I can use all the functions of the module base64. So the problem is coming from the word 'encode_base64'. Please help !
I tried to launch my program, and that error occures, I expected that it was going to work.
You have a local module C:\Users/edoua/Documents\email.py that is shadowing the email module from the Python standard library. Rename email.py to something else, or move it to somewhere that isn't on the Python path.
I am trying to run pox controller using the command
python2 ./pox.py forwarding. l3_detectionEntropyemphasized text
Then I got this error.
` Traceback (most recent call last):
File "./pox.py", line 43, in <module>
from pox.boot import boot
File "/home/name/pox/pox/boot.py", line 38, in <module>
import pox.core
File "/home/name/pox/pox/core.py", line 182, in <module>
import pox.lib.recoco as recoco
File "/home/name/pox/pox/lib/recoco/__init__.py", line 1, in <module>
from .recoco import *
File "/home/name/pox/pox/lib/recoco/recoco.py", line 17, in <module>
from queue import PriorityQueue
ImportError: No module named queue`
Also I have tried to run it in python3 by converting it into python3 Then i got this error.
`Traceback (most recent call last):
File "/home/shivani/pox/pox/boot.py", line 74, in do_import2
__import__(name, level=0)
File "/home/shivani/pox/pox/forwarding/l3_detectionEntropy.py", line 129
print "dpid port and its packet count: ", str(event.connection.dpid),
str(diction[event.connection.dpid]), str(diction[event.connection.dpid][event.port])
^
SyntaxError: invalid syntax
Could not import module: forwarding.l3_detectionEntropy`
How to solve these error??
Adding paranthesis around the print statement should fix the issue.
Python 3 would raise a SyntaxError if we called the print function the Python 2-way without the parentheses.
I am trying to connect Pepper to Dialogflow. The Dialogflow SDK is stored in the project folder/lib. The python version used by Pepper is 2.7. I use python 2.7.9.
self.folderName = os.path.join(self.framemanager.getBehaviorPath(self.behaviorId), "..\lib")
if self.folderName not in sys.path:
sys.path.append(self.folderName)
self.log(self.folderName)
import apiai
ai = apiai.ApiAI(CLIENT_ACCESS_TOKEN)
When running the code, I got the errors:
[ERROR] behavior.box :_safeCallOfUserMethod:281 _Behavior__lastUploadedChoregrapheBehaviorbehavior_1338328200__root__test_1: Traceback (most recent call last):
File "C:\PROGRA~2\ALDEBA~1\CHOREG~1.1\lib\naoqi.py", line 271, in _safeCallOfUserMethod
func()
File "<string>", line 23, in onInput_onStart
File "C:\Users\AppData\Roaming\PackageManager\apps\.lastUploadedChoregrapheBehavior\behavior_1\..\lib\apiai\__init__.py", line 9, in <module>
from .requests.query import Entry
File "C:\Users\AppData\Roaming\PackageManager\apps\.lastUploadedChoregrapheBehavior\behavior_1\..\lib\apiai\requests\__init__.py", line 3, in <module>
from .request import Request
File "C:\Users\loadedChoregrapheBehavior\behavior_1\..\lib\apiai\requests\request.py", line 9, in <module>
from httplib import HTTPSConnection
ImportError: cannot import name HTTPSConnection
Any ideas how to solve it?
This program must be run on the robot, rather than on your computer.
I'm using Pyshark and Python 2.6 on OS X 10.10. I simply try to import pyshark in my code, and this error is thrown. Any idea of what could be going wrong?
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 "/Users/spencergardner/Google Drive/development/python-sockets/sniff.py"
Traceback (most recent call last):
File "/Users/spencergardner/Google Drive/development/python-sockets/sniff.py", line 1, in <module>
import pyshark
File "/Library/Python/2.6/site-packages/pyshark/__init__.py", line 1, in <module>
from pyshark.capture.live_capture import LiveCapture
File "/Library/Python/2.6/site-packages/pyshark/capture/live_capture.py", line 1, in <module>
from pyshark.capture.capture import Capture
File "/Library/Python/2.6/site-packages/pyshark/capture/capture.py", line 12, in <module>
from pyshark.tshark.tshark_xml import packet_from_xml_packet, psml_structure_from_xml
File "/Library/Python/2.6/site-packages/pyshark/tshark/tshark_xml.py", line 5, in <module>
from pyshark.packet.layer import Layer
File "/Library/Python/2.6/site-packages/pyshark/packet/layer.py", line 57
return {slot: getattr(self, slot) for slot in self.__slots__}
^
SyntaxError: invalid syntax
The error is due to using a dictionary comprehension, a language feature that was introduced to Python 2 in 2.7, not the 2.6 you're trying to use. Apple ships OS X 10.10 with both 2.7 and 2.6. Is there a reason you can't use 2.7 instead?
I have a clean install of Python 3.3.2 on Windows 7. I'm trying to import html.parser.HTMLParser, using the example from the documentation: Simple HTML and XHTML parser
But I'm getting the error:
>>> from html.parser import HTMLParser
aee4
gg2
Traceback (most recent call last):
File "htmlang.py", line 1, in <module>
from html.parser import HTMLParser
File "c:\Python33\lib\html\parser.py", line 13, in <module>
import warnings
File "c:\Python33\lib\warnings.py", line 6, in <module>
import linecache
File "c:\Python33\lib\linecache.py", line 10, in <module>
import tokenize
File "c:\Python33\lib\tokenize.py", line 37, in <module>
__all__ = token.__all__ + ["COMMENT", "tokenize", "detect_encoding",
AttributeError: 'module' object has no attribute '__all__'
I have just opened the interpreter and typed the import line. Why it isn't working as expected? Why it is printing the weird "aee4" and "gg2" strings?
Just write "import HTMLParser" and it will work