wittmannf / jupyter-translate Goto Github PK
View Code? Open in Web Editor NEWPython script for translating jupyter notebook (.ipynb) files
Python script for translating jupyter notebook (.ipynb) files
Hi ! I cloned your repo and tried run python jupyter_translate.py playground.ipynb --languaje 'en'
and I got the following error
File "/home/rvcristiand/Documents/jupyter-translate/jupyter_translate.py", line 23 list_to_gen = lambda: [(yield x) for x in replacement_list] ^ SyntaxError: 'yield' inside list comprehension
Description:
Issue Summary:
When running the testpython jupyter_translate.py 01_intro.ipynb --language 'pt'
command with the provided script jupyter_translate.py
, I encountered an AttributeError: 'NoneType' object has no attribute 'group'
error. The error occurs in the context of using regular expressions and the group
attribute, but I'm having difficulty pinpointing the exact source of the issue.
Steps to Reproduce:
testpython jupyter_translate.py 01_intro.ipynb --language 'pt'
Expected Behavior:
I expected the script to execute without errors and successfully translate the Jupyter Notebook content into the specified language.
Actual Behavior:
The script encountered an AttributeError: 'NoneType' object has no attribute 'group'
error during execution.
Error Stack Trace:
Traceback (most recent call last):
File "jupyter_translate.py", line XXX, in jupyter_translate
...
result = match.group()
AttributeError: 'NoneType' object has no attribute 'group'
Code Snippet:
Here's the relevant portion of the code where the error occurs:
# ... (other code)
# Inside jupyter_translate function
# ...
if cell['cell_type'] == 'markdown':
if source[:3] == '```':
skip_row = not skip_row # Invert flag until I find next code block
if not skip_row:
if source not in ['```\n', '```', '\n'] and source[:4] != '<img':
# The following line is where the error occurs
data_translated['cells'][i]['source'][j] = translate_markdown(source, dest_language=language)
# ... (other code)
Additional Information:
Hey Man, i uses to transplante fast ai todo. It's working fine así i can see. I would just add a loader. Like printing the total numbers of cells AND the cell by cell like
Translating cell 3 of 192 etc etc.
I didnt think it was working until i added
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.