rstudio / cloudml

R interface to Google Cloud Machine Learning Engine
https://tensorflow.rstudio.com/tools/cloudml/
65 stars 24 forks source link

Attempt to fix write() argument must be str in deploy.py l40 using python3 #201

Closed javierluraschi closed 4 years ago

javierluraschi commented 5 years ago

Running

# train.R
saveRDS(lm(iris), "iris.rds")

with Python 3:

# cloudml.yml
trainingInput:
  scaleTier: BASIC
  pythonVersion: "3.5"
  runtimeVersion: "1.4"

Triggers

master-replica-0
Traceback (most recent call last): File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "/root/.local/lib/python3.5/site-packages/cloudml-model/cloudml/deploy.py", line 40, in <module> sys.stdout.write(line) TypeError: write() argument must be str, not bytes

Test should validate this does not break Python 2...

oliviervg1 commented 4 years ago

Hi @dfalbel - any ETA on when this could be merged in + a new release made available on CRAN?

oliviervg1 commented 4 years ago

also - not sure .decode('ascii') is the right answer here as a I just ran into the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/.local/lib/python3.7/site-packages/cloudml-model/cloudml/deploy.py", line 40, in <module>
    sys.stdout.write(line.decode('ascii'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 24: ordinal not in range(128)
necronet commented 4 years ago

I recently ran into this error while trying to deploy keras classification example into cloud ml! any reason why this still on hold ?

.decode('utf-8') worked for me.