Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HI #54

Closed
iammobina opened this issue May 27, 2019 · 8 comments
Closed

HI #54

iammobina opened this issue May 27, 2019 · 8 comments

Comments

@iammobina
Copy link

how can i use this ?please explain me clearly

@uxmal
Copy link
Owner

uxmal commented May 28, 2019

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.

@iammobina
Copy link
Author

iammobina commented May 29, 2019 via email

@uxmal
Copy link
Owner

uxmal commented May 29, 2019

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?

@SWATOPLUS
Copy link
Contributor

@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.

@uxmal
Copy link
Owner

uxmal commented May 29, 2019

@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.

@iammobina
Copy link
Author

iammobina commented May 31, 2019 via email

@uxmal
Copy link
Owner

uxmal commented May 31, 2019

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

@uxmal
Copy link
Owner

uxmal commented Jun 11, 2019

Closing due to inactivity. If your issue isnt resolved, reopen.

@uxmal uxmal closed this as completed Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants