idanpa / calcpy Goto Github PK
View Code? Open in Web Editor NEWTerminal calculator and advanced math solver using Python, IPython and SymPy
License: MIT License
Terminal calculator and advanced math solver using Python, IPython and SymPy
License: MIT License
I would like to publish this package to PyPi.
@ZhiqingXiao I see you own calcpy, but the package is actually empty, and the github repo is empty too.
Do you have plans for using calcpy? if no, could you kindly remove this package?
Thanks
Hi, thank you for writing calcpy, it's a great tool.
I tried to add this line to my IPython config file .config/ipython/profile_calcpy/ipython_config.py
:
c.TerminalInteractiveShell.editing_mode = "vi"
I then ran python3 calcpy_cli
and got this error:
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3.11/pathlib.py", line 1250, in is_dir
return S_ISDIR(self.stat().st_mode)
^^^^^^^^^
AttributeError: 'str' object has no attribute 'stat'
Original exception was:
Traceback (most recent call last):
File "/home/dogeystamp/.local/bin/calcpy/calcpy_cli.py", line 109, in <module>
main()
File "/home/dogeystamp/.local/bin/calcpy/calcpy_cli.py", line 106, in main
IPython.start_ipython(ipython_args)
File "/usr/lib/python3.11/site-packages/IPython/__init__.py", line 129, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/traitlets/config/application.py", line 1043, in launch_instance
app.start()
File "/usr/lib/python3.11/site-packages/IPython/terminal/ipapp.py", line 318, in start
self.shell.mainloop()
File "/usr/lib/python3.11/site-packages/IPython/terminal/interactiveshell.py", line 888, in mainloop
self.interact()
File "/usr/lib/python3.11/site-packages/IPython/terminal/interactiveshell.py", line 873, in interact
code = self.prompt_for_code()
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/IPython/terminal/interactiveshell.py", line 812, in prompt_for_code
text = self.pt_app.prompt(
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1035, in prompt
return self.app.run(
^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/prompt_toolkit/application/application.py", line 961, in run
return loop.run_until_complete(coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/prompt_toolkit/application/application.py", line 875, in run_async
return await _run_async(f)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/prompt_toolkit/application/application.py", line 676, in _run_async
self.reset()
File "/usr/lib/python3.11/site-packages/prompt_toolkit/application/application.py", line 432, in reset
self.vi_state.reset()
File "/usr/lib/python3.11/site-packages/prompt_toolkit/key_binding/vi_state.py", line 99, in reset
self.input_mode = InputMode.INSERT
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/IPython/terminal/shortcuts/__init__.py", line 370, in set_input_mode
sys.stdout.write(cursor)
TypeError: no_asyncio_write() missing 1 required positional argument: 'data'
It seems like the source of the error is this code from calcpy_cli.py:
# monkey patch prompt_toolkit to avoid printin from background for preview
# TODO: need a better fix
prompt_toolkit.patch_stdout.StdoutProxy.write = \
partial(no_asyncio_write, prompt_toolkit.patch_stdout.StdoutProxy.write)
I patched no_asyncio_write
like this:
def no_asyncio_write(write, self, data=None):
if data is None:
return
if not threading.currentThread().name.startswith('asyncio'):
write(self, data)
and it seemed to fix the crash.
Completely removing the monkey patch also fixes the crash.
I'm not quite sure what the purpose of your code is here, so I do not know if these fixes break any functionality of calcpy.
EDIT: the above no_asyncio_write
patch is just a workaround because it fails to actually write the data
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.