You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/02/09 15:55:39 UTC
[GitHub] [pulsar] zhaoyajun2009 opened a new issue #14193: [Python Client]Under the condition of python V2.7, after using pip to install the pulsar library, the production and consumption scripts in the sample cannot be executed
zhaoyajun2009 opened a new issue #14193:
URL: https://github.com/apache/pulsar/issues/14193
Question:
Follow the documentation below:
https://pulsar.apache.org/docs/zh-CN/client-libraries-python/#installation-using-pip
Under the condition of python V2.7, after using pip to install the pulsar library, the production and consumption scripts in the sample cannot be executed, and the prompt NameError: name 'ModuleNotFoundError' is not defined is displayed.
In the same situation, there is no problem in python V3.6.
The detail of error is refered to:
https://stackoverflow.com/questions/54153106/why-does-my-code-throw-nameerror-name-modulenotfounderror-is-not-defined-er
OS:
[ec2-user@]$ hostnamectl
Static hostname: ip-x-x-x-x.cn-north-1.compute.internal
Icon name: computer-vm
Chassis: vm
Virtualization: xen
Operating System: Amazon Linux 2
CPE OS Name: cpe:2.3:o:amazon:amazon_linux:2
Kernel: Linux 5.10.75-79.358.amzn2.x86_64
Architecture: x86-64
Python Version:2.7.18
[ec2-user@]$ cat producer.py
#!python
import pulsar
client = pulsar.Client('pulsar://localhost:6650')
producer = client.create_producer('my-topic')
for i in range(10):
producer.send(('Hello-%d' % i).encode('utf-8'))
client.close()
[ec2-user@ python2.7]$ python producer.py
Traceback (most recent call last):
File "producer.py", line 2, in <module>
import pulsar
File "/home/ec2-user/.local/lib/python2.7/site-packages/pulsar/__init__.py", line 112, in <module>
from pulsar import schema
File "/home/ec2-user/.local/lib/python2.7/site-packages/pulsar/schema/__init__.py", line 24, in <module>
from .schema_avro import AvroSchema
File "/home/ec2-user/.local/lib/python2.7/site-packages/pulsar/schema/schema_avro.py", line 30, in <module>
except ModuleNotFoundError:
NameError: name 'ModuleNotFoundError' is not defined
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] BewareMyPower closed issue #14193: [Python Client]Under the condition of python V2.7, after using pip to install the pulsar library, the production and consumption scripts in the sample cannot be executed
Posted by GitBox <gi...@apache.org>.
BewareMyPower closed issue #14193:
URL: https://github.com/apache/pulsar/issues/14193
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org