Visual foxpro to python

Как преобразовать код Foxpro (файл prg) в Python

Сейчас у меня есть довольно большая программа, написанная на FoxPro (файл prg). Сейчас FoxPro действительно устаревает, поэтому я хочу спросить следующее: Можно ли преобразовать весь код FoxPro (файл .prg) в Python? Есть ли для этого простой трюк / код? Python должен стать моей основной платформой для кодирования, поэтому мне больше не нужно использовать FoxPro, когда я хочу скорректировать какой-то код или что-то еще. У кого-нибудь есть опыт с этим? Я надеюсь получить известие от вас, ценю вашу помощь. PS: Обратите внимание, что я новичок в Python.

Вашей программе нужна база данных? Ваше приложение одно- или многопользовательское? Если это однопользовательское приложение без базы данных, будет довольно легко преобразовать ваш код вручную. Если у вас есть основы Python, вам нужно найти какой-нибудь GUI-Framework, с которым можно было бы работать. Преобразование ваших Foxpro-Forms в Python, вероятно, будет самым продвинутым делом. Изменить: как уже упоминали другие, исправление ошибок, сгенерированных инструментом-конвертером, определенно займет больше времени, чем переписывание кода. — person DerHamm &nbsp schedule 20.04.2020

Читайте также:  Thymeleaf set javascript variable

Много лет назад опытный разработчик VFP по имени Эд Лиф создал фреймворк Python под названием Dabo, который, как я полагаю, должен был упростить переход для разработчиков VFP. Я не знаю, что это за текущий статус, но с этого можно было бы начать. — person Tamar E. Granor &nbsp schedule 20.04.2020

@ TamarE.Granor Похоже, что Dabo в настоящее время находится в режиме обслуживания. Он был написан для Python 2, и перенос на Python 3 не завершен. Репозиторий github не очень активен. — person Roland Smith &nbsp schedule 20.04.2020

@DerHamm, Да, моей программе нужна база данных и, насколько я знаю, она многопользовательская, потому что мы используем ее в нашей организации. Я знаю, что переписывание, возможно, лучший вариант. — person ManCity10 &nbsp schedule 21.04.2020

Ответы (2)

Есть много людей из сообщества FoxPro, которые перешли в мир Python, но я не знаю инструментов для преобразования исходного кода. Как и в случае с большинством вопросов типа «могу ли я преобразовать язык x в язык y», вы потратите больше времени на приведение результата в форму, чем просто на документирование и переписывание. В разделе загрузки на Leafe.com есть несколько сценариев Python, которые реализуют общие функции Visual FoxPro.

Возможно, вы захотите проверить этот вопрос. Также существует vfp2py. Python поставляется с поддержкой отличной базы данных SQLite, встроенной в модуль sqlite3 . (Вы наверняка уже используете sqlite, но можете даже не знать об этом.) Хранение данных в База данных sqlite означает, что вам не придется беспокоиться о том, что вы не сможете получить к ней доступ до конца своей жизни.

Если у OP есть приложение FoxPro или Visual FoxPro, вероятность того, что он использует SQLite, крайне мала. Скорее всего, это либо собственная база данных FoxPro, либо SQL Server, либо MySQL. — person Tamar E. Granor; 20.04.2020

Читайте также:  Php json decode json error syntax

@ TamarE.Granor Я имел в виду, что он практически повсеместен в браузерах и на смартфонах. — person Roland Smith; 20.04.2020

Источник

vfp2py

vfp2py is an attempt to create a tool to automatically create python code from foxpro 9 code.

Many but not nearly all commands are currently supported with missing commands to be added as need arises. Conversion can be done on individual prg files or whole projects pjx files.

Features

  • Translates code comments
  • Handles preprocessor commands
  • Support for reading and writing dbf files via Ethan Furman’s dbf package
  • Many functions are inlined in the generated python code.
  • Many complex functions and commands are available through a runtime — vfpfunc.py
  • Somewhat functioning gui using PySide

Future work

  • Add more commands to parser
  • Improve gui
  • Rework scoping to facilitate operation of some commands.
  • Add missing code conversion for some commands currently supported by parser
  • Add more runtime functions
  • Put package on pypi for easier install
  • Speed up parsing

Installation

python -m pip install vfp2py

Usage

 $ vfp2py --help usage: vfp2py [-h] [--logging] infile outpath [search [search . ]] Tool for rewriting Foxpro code in Python positional arguments: infile file to convert - supported file types are prg, mpr, spr, scx, vcx, or pjx, outpath path to output converted code, will be a filename for all but pjx which will be a directory search directory to search for included files optional arguments: -h, --help show this help message and exit --logging file to convert 

To convert a file simply run vfp2py —logging input_file.prg output_file.py or vfp2py —logging input_project.pjx output_directory

Acknowledgments

Jayanta Narayan Choudhuri for providing a list of keyword and function abbreviations.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Convert Visual FoxPro(VFP) code into python code

License

mwisslead/vfp2py

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

vfp2py is an attempt to create a tool to automatically create python code from foxpro 9 code.

Many but not nearly all commands are currently supported with missing commands to be added as need arises. Conversion can be done on individual prg files or whole projects pjx files.

  • Translates code comments
  • Handles preprocessor commands
  • Support for reading and writing dbf files via Ethan Furman’s dbf package
  • Many functions are inlined in the generated python code.
  • Many complex functions and commands are available through a runtime — vfpfunc.py
  • Somewhat functioning gui using PySide
  • Add more commands to parser
  • Improve gui
  • Rework scoping to facilitate operation of some commands.
  • Add missing code conversion for some commands currently supported by parser
  • Add more runtime functions
  • Put package on pypi for easier install
  • Speed up parsing

python -m pip install vfp2py

 $ vfp2py --help usage: vfp2py [-h] [--logging] infile outpath [search [search . ]] Tool for rewriting Foxpro code in Python positional arguments: infile file to convert - supported file types are prg, mpr, spr, scx, vcx, or pjx, outpath path to output converted code, will be a filename for all but pjx which will be a directory search directory to search for included files optional arguments: -h, --help show this help message and exit --logging file to convert 

To convert a file simply run vfp2py —logging input_file.prg output_file.py or vfp2py —logging input_project.pjx output_directory

Jayanta Narayan Choudhuri for providing a list of keyword and function abbreviations.

About

Convert Visual FoxPro(VFP) code into python code

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Use python dll to easily run python code inside foxpro.

mwisslead/VFP-Embedded-Python

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Call python code directly from foxpro.

foxpro2python is a set of foxpro classes and functions that allow simple execution of python code from within a foxpro program.

Please see the example.prg for some usage examples.

  • Automatically converts between basic data types.
  • Errors raised in python are automatically raised as foxpro errors.
  • Add python.prg to your project.
  • Make sure python is installed on the machine or place the python folder(Python27, Python36, etc.) into the working directory of the foxpro program.
  • Call the start_python procedure in python.prg with the python folder location (Python27 in the current directory is assumed if no argument is passed)
  • Call python functions with the PythonFunctionCall function (e.g. PythonFunctionCall(‘random’, ‘randint’, CreateObject(‘PythonTuple’, 5, 20)) is like calling random.randint(5, 20) in python)
  • Get items and attributes with obj.getitem and obj.getattr (e.g obj.getitem(‘key’) will retrieve the dictionary item with key ‘key’)

About

Use python dll to easily run python code inside foxpro.

Источник

Оцените статью