python rq Queue import error - python

I'm using python v2.7.3 - Installed python-rq via easy_install. While trying to create RQ queue with steps given at http://python-rq.org/ . it fails with message like
>>> from redis import Redis
>>> from rq import Queue
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "rq.py", line 11, in <module>
q = Queue(connection=Redis())
TypeError: 'module' object is not callable
>>>
>>> q = Queue(connection=Redis())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'Queue' is not defined
>>>
Whats the issue here and how to fix this?

Reposting comment as answer:
Thanks for the answer. Sorry stupid me! .sometime back I created file named rq.py and its creating problem. Deleted that file.solved the issue

Related

ray.services.get_node_ip_address() doesn't work. ray cluster python

I am learning to use ray on a cluster from the official documentation
I just wanted to test a single functionality which is ray.services.get_node_ip_address(), but I have the following error:
>>> import ray
>>> ray.services.get_node_ip_address()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'ray' has no attribute 'services'
It is in ray._private.services.get_node_ip_address()
It seems that the location of get_node_ip_address() is changed from ray.services.get_node_ip_address() to ray._private.services.get_node_ip_address()

why web3.eth.getBlock gives null answer and getTransactionReceipt gives error?

I am using Web3.py in my python code. The code is like this
from web3 import Web3
w3 = Web3(Web3.HTTPProvider("https://ropsten.infura.io/"))*
for i in range(5000000,5100000):
print(i)
transactionArray = []
blockResult = w3.eth.getBlock(i)
for tx in blockResult["transactions"]:
txResult = binascii.hexlify(tx).decode()
print(txResult)
transactionResult = w3.getTransactionReceipt(txResult)
print(transactionResult)
When I execute this code, getting error
5000000
Traceback (most recent call last):
File "Test06.py", line 27, in <module>
for tx in blockResult["transactions"]:
TypeError: 'NoneType' object is not subscriptable
but If I start range from 4571699 it gives me the result. Can somebody tell me why I'm getting an error for range starts from 5000000
I use the MAIN NET, so resolved this problem. But now I am getting an error as
Traceback (most recent call last):
File "Test06.py", line 35, in <module>
transactionResult = w3.getTransactionReceipt(txResult)
AttributeError: 'Web3' object has no attribute 'getTransactionReceipt'.
You're using the ropsten test chain which only has 4572019 blocks as of this answer.

Cannot run python-escpos methods

I have an Epson thermal printer (TM-82), connected via USB. I am using python-escpos library (version v2.2.0) I am trying to run some of Escpos module's methods such has ln(), textln(), etc. But none of these commands work, and I get an error 'Usb' object has no attribute <method_name>. The only commands that work are text(), qrcode(), barcode(), image() and cut().
Can you guys please tell me what's wrong?
Steps to reproduce
>>> from escpos import printer
>>> p = printer.Usb(0x04b8, 0x0e11, 0)
>>> p.text('hello')
>>> p.ln()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Usb' object has no attribute 'ln'
>>> p.is_online()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Usb' object has no attribute 'is_online'
If you are using python-escpos 2.2.0, look at the source and documentation for that version.
There is no ln or is_online function in that version.

Apache Zeppelin Pymongo Error

The following code on apache zeppelin (version 0.6.1)
%python
import pandas as pd
del(listResult)
listResult = list(collection.distinct("species",{"yr": yrs,"species":{"$ne":""}}))
df = pd.DataFrame(listResult,columns=['Species sighted and/or captured this year'])
z.show(df)
only works at the first time i click "run all paragraphs".
After that, if i run the paragraph, the following error appears:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 27, in show
File "<stdin>", line 32, in show_dataframe
TypeError: 'list' object is not callable
It only works againd when i restart python interpreter. Can you help me understand what's happening?
Thanks!

I can't start successfully boa constructor in windows7

When I start boa-constructor(boa-constructor-0.6.1.src.win32.exe) from the command line by starting the script "Boa.py", I got the message says
My python version is "python-2.7.7.msi" and I download wxPyton "wxPython3.0-win32-3.0.0.0-py27.exe"
O searched for files that contains the string "NO_3D " but I didn't get any can you help me pleaze and thanks
Actually you will require wxPython 2.8.12.1 to not get this error.
>>> import wx
>>> wx.__version__
'2.8.12.1'
>>> wx.NO_3D
0
This is a pity, because the operation …|wx.NO_3D is actually a No-Op. So you could fix this particular issue by defining wx.NO_3D somewhere.
On 2.9.5:
>>> import wx
>>> wx.__version__
'2.9.5.0'
>>> wx.NO_3D
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'NO_3D'

Categories

Resources