Comments (8)
I tried reaching you on gitter but got no reply.
Pytocs is a translating tool that translates Python source code to C#. This is done by giving pytocs either the name of a Python source file or the name of a file system directory containing Python files. The tool then generates, for each python file, a corresponding translated C# file.
The README.md file contains the instructions for how to build and use the command line version of Pytocs. You can also use the pytocs GUI shell (provided by @SWATOPLUS) if you prefer working that way.
from pytocs.
from pytocs.
Here is what happens when I compile the pytocs.sln solution and use the resulting command line program pytocs.exe
(which is on my $PATH
) to translate a Python file:
C:\tmp\test>copy con test.py
def foo(a, b):
return a + b
^Z
1 file(s) copied.
C:\tmp\test>pytocs test.py
C:\tmp\test>type test.py.cs
public static class test {
public static object foo(object a, object b) {
return a + b;
}
}
C:\tmp\test>
I captured this output from cmd.exe
. Could you do the same thing on your end to show me exactly how you are using the tool?
from pytocs.
@iammobina Could you send your source file filecontroller.py ? Maybe this file contains some code which is currently unsupported by pytocs. If you send this file, I will test it and try to fix this issue.
from pytocs.
@SWATOPLUS has a point: although Pytocs should be able to parse most Python 2.x and Python 3.x code, there may naturally be bugs in the Python parser. However, I've seen this error before and most of the time it's because the pytocs
command line tool isn't being used correctly.
from pytocs.
from pytocs.
I copied the code above to a file, calling it test.py
, commented out lines 328-347, consisting mostly of numbers, commas, asterisks and the '->' symbol, and ran pytocs like this on the command line:
D:\dev\tmp>pytocs -r .
AST cache is at: C:\Users\jkl\AppData\Local\Temp\pytocs\ast_cache
100% (1 of 1) SPEED: 250/s AVG SPEED: 166/s Finished loading files. 18 functions were called.
Analyzing uncalled functions.
100% (1 of 1) SPEED: 0/s AVG SPEED: 1/s
---------------- Analysis symmary ----------------
- total time: 00:00:00
- modules loaded: 1
- semantic problems: 1
- failed to parse: 0
- number of definitions: 1199
- number of cross references: 1143
- number of references: 703
- resolved names: 596
- unresolved names: 3
- name resolve rate: 99%
D:\dev\tmp>
I've attached the Python file and the resulting C# file (packed in a zip file).
@iammobina: please try doing exactly what I did above, making sure that pytocs.exe
is on your PATH
.
test.zip
from pytocs.
Closing due to inactivity. If your issue isnt resolved, reopen.
from pytocs.
Related Issues (20)
- Convert a folder with PyTorch Jupyter Nodebooks HOT 3
- error, colon missing, convert the [:,t,:] syntax of python language into C#
- pytocs does not work HOT 2
- Add Github label: Torchsharp
- pytocs "d_keys = d_keys or (d_model//n_heads)" iserror
- Compiling to Release - Pound symbol in string literal HOT 1
- [WIP: Help] PyTorch to TorchSharp: the python way HOT 1
- The UI crashes on Windows 11 when browsing HOT 2
- can't build for VS2022 and .net 6 HOT 3
- Recognize `@abstractmethod` attribute
- Recognize constant negative list indices
- Translate `is None` to `is null`
- parser error Expected token type NEWLINE but saw ID. HOT 1
- pytocs 6.0 cli exception HOT 1
- 2.0.1 Errors Unexpected token {OP_GT} and Expected token type ID but saw LPAREN. HOT 2
- Add this class when meeting math
- csharp Keywords HOT 2
- change "void" to "object"
- parser error. Expected token type NEWLINE but saw AT. HOT 2
- parser error. More than one keyword argument specifier. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytocs.