I was running a script to get data from excel for over a year using the Xlwings range command like so...
list=Range('A1:D10').value
Suddenly, it stopper working. I had changed nothing in the code nor the system, other than maybe installing another network card.
This is the error when trying to use the Range assignment now.
Traceback (most recent call last):
File "G:\python32\fetcher.py", line 61, in <module>
listFull = getComData()
File "G:\python32\fetcher.py", line 38, in getComData
listFull=Range('A4:H184').value
File "G:\python32\lib\site-packages\xlwings\main.py", line 1490, in __init__
impl = apps.active.range(cell1).impl
File "G:\python32\lib\site-packages\xlwings\main.py", line 439, in range
return Range(impl=self.impl.range(cell1, cell2))
File "G:\python32\lib\site-packages\xlwings\_xlwindows.py", line 457, in range
xl1 = self.xl.Range(arg1)
File "G:\python32\lib\site-packages\xlwings\_xlwindows.py", line 341, in xl
self._xl = get_xl_app_from_hwnd(self._hwnd)
File "G:\python32\lib\site-packages\xlwings\_xlwindows.py", line 251, in get_xl_app_from_hwnd
disp = COMRetryObjectWrapper(Dispatch(p))
File "G:\python32\lib\site-packages\win32com\client\__init__.py", line 96, in Dispatch
return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, clsctx=clsctx)
File "G:\python32\lib\site-packages\win32com\client\__init__.py", line 37, in __WrapDispatch
klass = gencache.GetClassForCLSID(resultCLSID)
File "G:\python32\lib\site-packages\win32com\client\gencache.py", line 180, in GetClassForCLSID
mod = GetModuleForCLSID(clsid)
File "G:\python32\lib\site-packages\win32com\client\gencache.py", line 223, in GetModuleForCLSID
mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor)
File "G:\python32\lib\site-packages\win32com\client\gencache.py", line 259, in GetModuleForTypelib
mod = _GetModule(modName)
File "G:\python32\lib\site-packages\win32com\client\gencache.py", line 622, in _GetModule
mod = __import__(mod_name)
ValueError: source code string cannot contain null bytes
Related
OS: Mac,
Programming Language version: Python 3.8.3,
CCXT version: '1.77.71'
Hello when I execute the below code I continue to receive the ValueError shown below. When I test a different order exchange.create_order("ETH/USD:ETH", "limit","sell", order_size, 3650) it functions without a problem. It seems to be something I am doing with the stop market order specifically. I've spent about 5 hours now searching so I could really use some help. The exchange is Deribit.
S_order = exchange.create_order("ETH/USD:ETH", "stop_market","sell", order_size, None, {"trigger_price": 3470, "trigger": "last_price"})
Traceback (most recent call last): File "/Users/al/Desktop/Visual Studio/Test/RH_boty.py", line 142, in
schedule.run_pending() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/schedule/__init__.py",
line 780, in run_pending
default_scheduler.run_pending() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/schedule/__init__.py",
line 100, in run_pending
self._run_job(job) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/schedule/__init__.py",
line 172, in _run_job
ret = job.run() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/schedule/__init__.py",
line 661, in run
ret = self.job_func() File "/Users/al/Desktop/Visual Studio/Test/RH_boty.py", line 135, in run_bot
check_buy_sell_signals(reversal_hunter_data) File "/Users/al/Desktop/Visual Studio/Test/RH_boty.py", line 98, in
check_buy_sell_signals
S_order = exchange.create_order("ETH/USD:ETH", "stop_market","sell", order_size, None, {"trigger_price": 3470,
"type": "stop_market", "trigger": "last_price"}) File
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ccxt/deribit.py",
line 1359, in create_order
return self.parse_order(order, market) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ccxt/deribit.py",
line 1201, in parse_order
return self.safe_order({ File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ccxt/base/exchange.py",
line 2564, in safe_order
price = self.omit_zero(self.safe_string(order, 'price')) **File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ccxt/base/exchange.py",
line 2732, in omit_zero
if float(string_number) == 0: ValueError: could not convert string to float: 'market_price'**
So, I have this very basic script that concatenates two videos, and adds a background sound.
def intro():
voiceoverIntro = AudioFileClip(audio[3]) #get path for intro.mp3
introVideo = []
temp = p1vid + p2vid + p3vid
for x in temp: # add product videos to introVideo if they are longer than intro.mp3
x = VideoFileClip(x)
if x.duration >= voiceoverIntro.duration:
introVideo.append(x)
if len(introVideo) >= 1:
#Get the video and turn off its volume
introBg = introVideo[0].volumex(0).resize((1280,720))
introBg = introBg.set_audio(voiceoverIntro).set_duration(voiceoverIntro.duration)
introBg.reader.close()
introBg.audio.reader.close_proc()
return introBg
And this function creates the second clip
def productThreeOpener(productName):
opener3 = VideoFileClip("media/number3.mp4").volumex(0).resize((1280,720))
text = TextClip(productName,fontsize=60,color='white', font="Dekar")\
.set_pos(("right", "center"))\
.set_duration(3)\
.set_start(2)\
.crossfadein(1)\
.crossfadeout(1)\
.margin(right=200,opacity=0)
opener3 = CompositeVideoClip([opener3, text])
return opener3
Now we just concatenate the two outputs
final_clip = concatenate_videoclips([intro, productThreeOpener], method="compose")
final_clip.resize((1280, 720)).write_videofile("output/intro.mp4", threads=8, fps=24, progress_bar=False)
Running the code above returns this error;
Traceback (most recent call last):
[MoviePy] >>>> Building video output/intro.mp4
File "C:/Users/Akbulut/PycharmProjects/youtubeVideoEditor/vidEditor/sandbox.py", line 145, in <module>
[MoviePy] Writing audio in introTEMP_MPY_wvf_snd.mp3
final_clip.write_videofile("output/intro.mp4", threads=8, fps=24, progress_bar=False)
File "<decorator-gen-51>", line 2, in write_videofile
File "C:\Program Files\Python36\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "<decorator-gen-50>", line 2, in write_videofile
File "C:\Program Files\Python36\lib\site-packages\moviepy\decorators.py", line 137, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
File "<decorator-gen-49>", line 2, in write_videofile
File "C:\Program Files\Python36\lib\site-packages\moviepy\decorators.py", line 22, in convert_masks_to_RGB
return f(clip, *a, **k)
File "C:\Program Files\Python36\lib\site-packages\moviepy\video\VideoClip.py", line 318, in write_videofile
progress_bar=progress_bar)
File "<decorator-gen-73>", line 2, in write_audiofile
File "C:\Program Files\Python36\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "C:\Program Files\Python36\lib\site-packages\moviepy\audio\AudioClip.py", line 213, in write_audiofile
progress_bar=progress_bar)
File "<decorator-gen-70>", line 2, in ffmpeg_audiowrite
File "C:\Program Files\Python36\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "C:\Program Files\Python36\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 165, in ffmpeg_audiowrite
ffmpeg_params=ffmpeg_params)
File "C:\Program Files\Python36\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 71, in __init__
self.proc = sp.Popen(cmd, **popen_params)
File "C:\Program Files\Python36\lib\subprocess.py", line 594, in __init__
_cleanup()
File "C:\Program Files\Python36\lib\subprocess.py", line 205, in _cleanup
res = inst._internal_poll(_deadstate=sys.maxsize)
File "C:\Program Files\Python36\lib\subprocess.py", line 1025, in _internal_poll
if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
OSError: [WinError 6] İşleyici geçersiz
Exception ignored in: <bound method FFMPEG_AudioWriter.__del__ of <moviepy.audio.io.ffmpeg_audiowriter.FFMPEG_AudioWriter object at 0x0000000A885019B0>>
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 134, in __del__
self.close()
File "C:\Program Files\Python36\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 122, in close
if self.proc:
AttributeError: 'FFMPEG_AudioWriter' object has no attribute 'proc'
Process finished with exit code 1
I strictly followed MoviePY installation guide, installed it and all of its dependencies about 2 days ago. I work on a 64b Windows machine. Python version 3.6.1
I've been stuck with this error for over a day now, and I don't know what to try.. Any help/advice is highly appreciated.
Thanks.
Can someone help me with the stacktrace generated while using happybase library?
I am trying to pass a dictionary object of python 3.4 in the 'put' method and the following stack trace is generated::
x
b"TWLb'25-Jan-13'"
data_values
{b'Low': b'0.10', b'Date': b'25-Jan-13', b'Volume': b'-', b'Close': b'0.12', b'High': b'0.12', b'Open': b'0.12'}
Traceback (most recent call last):
File "/home/msingal/Desktop/asd/Daily.py", line 63, in insert
hbase_test.insert_data(code, data_format)
File "/home/msingal/Desktop/asd/hbase_test.py", line 56, in insert_data
con.table(ticker, use_prefix=False).put(x, data_values)
File "/usr/lib/python3.4/site-packages/happybase/table.py", line 464, in put
batch.put(row, data)
File "/usr/lib/python3.4/site-packages/happybase/batch.py", line 137, in __exit__
self.send()
File "/usr/lib/python3.4/site-packages/happybase/batch.py", line 60, in send
self._table.connection.client.mutateRows(self._table.name, bms, {})
File "/usr/lib64/python3.4/site-packages/thriftpy/thrift.py", line 198, in _req
return self._recv(_api)
File "/usr/lib64/python3.4/site-packages/thriftpy/thrift.py", line 210, in _recv
fname, mtype, rseqid = self._iprot.read_message_begin()
File "thriftpy/protocol/cybin/cybin.pyx", line 429, in cybin.TCyBinaryProtocol.read_message_begin (thriftpy/protocol/cybin/cybin.c:6325)
File "thriftpy/protocol/cybin/cybin.pyx", line 60, in cybin.read_i32 (thriftpy/protocol/cybin/cybin.c:1546)
File "thriftpy/transport/buffered/cybuffered.pyx", line 65, in thriftpy.transport.buffered.cybuffered.TCyBufferedTransport.c_read (thriftpy/transport/buffered/cybuffered.c:1881)
File "thriftpy/transport/buffered/cybuffered.pyx", line 69, in thriftpy.transport.buffered.cybuffered.TCyBufferedTransport.read_trans (thriftpy/transport/buffered/cybuffered.c:1948)
File "thriftpy/transport/cybase.pyx", line 61, in thriftpy.transport.cybase.TCyBuffer.read_trans (thriftpy/transport/cybase.c:1472)
File "/usr/lib64/python3.4/site-packages/thriftpy/transport/socket.py", line 125, in read
message='TSocket read 0 bytes')
thriftpy.transport.TTransportException: TTransportException(message='TSocket read 0 bytes', type=4)
The lines of code are::
ticker = 'TWLB'
data_values = {b'Low': b'0.10', b'Date': b'25-Jan-13', b'Volume': b'-', b'Close': b'0.12', b'High': b'0.12', b'Open': b'0.12'}
x = (ticker + str(data_values.get(b'Date'))).encode('ASCII')
print('x')
print(x)
print('data_values')
print(data_values)
con.table(ticker, use_prefix=False).put(x, data_values)
Any help on solution and explaination would be apprciated.
I am new to StackOverflow so if my language feels offencive, please forgive me. I have tried to provide all the relevant info but if some info is missing let me know and I will update.
In order to read few files from common crawl I have written this script
import warc
import boto
for line in sys.stdin:
line = line.strip()
#Connect to AWS and read a dataset
conn = boto.connect_s3(anon=True, host='s3.amazonaws.com')
pds = conn.get_bucket('commoncrawl')
k = Key(pds)
k.key = line
f = warc.WARCFile(fileobj=GzipStreamFile(k))
skipped_doc = 0
for num, record in enumerate(f):
# analysis code
Where each line is the key of warc files. When I run this script to analyze 5 files, I got this exception
Traceback (most recent call last):
File "./warc_mapper_full.py", line 42, in <module>
for num, record in enumerate(f):
File "/usr/lib/python2.7/site-packages/warc/warc.py", line 393, in __iter__
record = self.read_record()
File "/usr/lib/python2.7/site-packages/warc/warc.py", line 364, in read_record
self.finish_reading_current_record()
File "/usr/lib/python2.7/site-packages/warc/warc.py", line 358, in finish_reading_current_record
self.current_payload.read()
File "/usr/lib/python2.7/site-packages/warc/utils.py", line 59, in read
return self._read(self.length)
File "/usr/lib/python2.7/site-packages/warc/utils.py", line 69, in _read
content = self.buf + self.fileobj.read(size)
File "/home/hpcnl/Documents/kics/current_work/aws/tasks/warc-analysis/src/gzipstream/gzipstream/gzipstreamfile.py", line 67, in read
result = super(GzipStreamFile, self).read(*args, **kwargs)
File "/home/hpcnl/Documents/kics/current_work/aws/tasks/warc-analysis/src/gzipstream/gzipstream/gzipstreamfile.py", line 48, in readinto
data = self.read(len(b))
File "/home/hpcnl/Documents/kics/current_work/aws/tasks/warc-analysis/src/gzipstream/gzipstream/gzipstreamfile.py", line 38, in read
raw = self.stream.read(io.DEFAULT_BUFFER_SIZE)
File "/usr/lib/python2.7/site-packages/boto/s3/key.py", line 400, in read
data = self.resp.read(size)
File "/usr/lib/python2.7/site-packages/boto/connection.py", line 413, in read
return http_client.HTTPResponse.read(self, amt)
File "/usr/lib64/python2.7/httplib.py", line 602, in read
s = self.fp.read(amt)
File "/usr/lib64/python2.7/socket.py", line 380, in read
data = self._sock.recv(left)
File "/usr/lib64/python2.7/ssl.py", line 736, in recv
return self.read(buflen)
File "/usr/lib64/python2.7/ssl.py", line 630, in read
v = self._sslobj.read(len or 1024)
ssl.SSLError: ('The read operation timed out',)
I run it many times. Above exception happened every time. Where is the problem ?
I learn to use polyglot to give POS tag Indonesian texts.
import polyglot
from polyglot.text import Text, Word
text=Text("Menurut dia, Syahganda, dikenal sebagai penggiat isu-isu pertanahan serta perburuhan.")
print text.pos_tags
But error appeared:
Traceback (most recent call last):
File "polyglot-tagger.py", line 35, in <module>
arrTag=text.pos_tags
File "/usr/local/lib/python2.7/dist-packages/polyglot/decorators.py", line 20, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/usr/local/lib/python2.7/dist-packages/polyglot/text.py", line 147, in pos_tags
for word,t in self.pos_tagger.annotate(self.words):
File "/usr/local/lib/python2.7/dist-packages/polyglot/decorators.py", line 20, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/usr/local/lib/python2.7/dist-packages/polyglot/text.py", line 100, in pos_tagger
return get_pos_tagger(lang=self.language.code)
File "/usr/local/lib/python2.7/dist-packages/polyglot/decorators.py", line 30, in memoizer
cache[key] = obj(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/polyglot/tag/base.py", line 147, in get_pos_tagger
return POSTagger(lang=lang)
File "/usr/local/lib/python2.7/dist-packages/polyglot/tag/base.py", line 126, in __init__
super(POSTagger, self).__init__(lang=lang)
File "/usr/local/lib/python2.7/dist-packages/polyglot/tag/base.py", line 40, in __init__
self.predictor = self._load_network()
File "/usr/local/lib/python2.7/dist-packages/polyglot/tag/base.py", line 134, in _load_network
self.model = load_pos_model(lang=self.lang, version=2)
File "/usr/local/lib/python2.7/dist-packages/polyglot/decorators.py", line 30, in memoizer
cache[key] = obj(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/polyglot/load.py", line 114, in load_pos_model
p = locate_resource(src_dir, lang)
File "/usr/local/lib/python2.7/dist-packages/polyglot/load.py", line 47, in locate_resource
if downloader.status(package_id) != downloader.INSTALLED:
File "/usr/local/lib/python2.7/dist-packages/polyglot/downloader.py", line 737, in status
info = self._info_or_id(info_or_id)
File "/usr/local/lib/python2.7/dist-packages/polyglot/downloader.py", line 507, in _info_or_id
return self.info(info_or_id)
File "/usr/local/lib/python2.7/dist-packages/polyglot/downloader.py", line 933, in info
raise ValueError('Package %r not found in index' % id)
ValueError: Package u'pos2.ms' not found in index
When I tried to download pos2.ms(Part-of-speech Model for Malay), it doesn't exists in model. What should I do?
**I use Ubuntu and python 2.7
Thanks for your help before
Check the language coverage for Malay
http://polyglot.readthedocs.org/en/latest/POS.html#languages-coverage
We are planning to add more languages in the futrue