Comments (3)
@kaasima10 I have tested pyflowchart 0.3.1 with python 3.11 and astunparse 1.6.3 as you described, on some basic cases I tried, it works fine. Would you mind to post your inputted python source code and command executed that helps reproduce this problem?
from pyflowchart.
this is my python code :-
import pyflowchart as pfc
import inspect
def example_function(x):
if x > 0:
return 'Positive'
elif x < 0:
return 'Negative'
else:
return 'Zero'
code = inspect.getsource(example_function)
fc = pfc.parse(code)
flowchart = fc.flowchart()
print(flowchart)
@cdfmlr I encountered an AttributeError when attempting to convert a simple Python function to a flowchart using the pyflowchart library. The function is straightforward, but the error occurs during the conversion process.
from pyflowchart.
Thanks. Have figured it out.
You should use:
from pyflowchart import Flowchart
...
fc = Flowchart.from_code(code)
...
instead of:
import pyflowchart as pfc
...
fc = pfc.parse(code)
...
As described in our document section Python to Flowchart, Flowchart.from_code
is the right method you are expected to converts python source code from a str
to the flowchart:
pyflowchart/pyflowchart/flowchart.py
Lines 42 to 56 in dcb5128
Meanwhile, parse
is an internal function that parses the abstract syntax trees of python codes, instead of a str
of python source code:
pyflowchart/pyflowchart/ast_node.py
Lines 929 to 943 in dcb5128
Users shall never call this function from the out of the package.
from pyflowchart.
Related Issues (20)
- aa HOT 1
- When running pyflowchart, an error is displayed and the flowchart code cannot be found. HOT 5
- How can a ConditionNode deal with 3 conditions HOT 2
- ConditionNode alignment support HOT 5
- Parallel node support HOT 3
- CLI running `python3 -m pyflowchart simple.py` got no outputs HOT 1
- Try and Execption Doesn't support HOT 9
- How to save the svg? HOT 1
- How about targetting diagrams library too? HOT 1
- Please add `scroll to zoom` functionality if possible. HOT 2
- Cannot read properties of null HOT 2
- Is there an option to create a heatmap? HOT 1
- Chinese README is not updated. 更新中文文档
- TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' HOT 3
- Support for match-case statement: AttributeError: 'Unparser' object has no attribute '_Match' HOT 11
- Nodes: white spaces and shpes HOT 1
- windows: UnicodeDecodeError: 'gbk' codec can't decode HOT 11
- TODO Items HOT 4
- for loop rendered as an operation not a loop HOT 4
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 pyflowchart.