Re: [Generateds-discuss] generateDS question
Brought to you by:
dkuhlman
From: Dave K. <dku...@da...> - 2021-10-15 18:07:04
|
Vladan, Thanks for reporting back. Glad you solved your problem. Thanks for telling me about the `.env` file. I did not know about that and about the `dotenv` module. I'll read up on it. `generateds` is hosted at Source Forge: https://sourceforge.net/projects/generateds/ You can clone the code. If you have something that you believe needs a fix, you can create a ticket. If you have a fix, you can fork `generateds`, make your suggested changes, and send me a pull request. If you want to ask a question or discuss something, there is a mailing list. I should try to remember to CC that list myself. Dave On Fri 15 Oct 2021 01:19:07 AM PDT, Vladan Cvejic wrote: > Hello Dave, > > Just dropped by to thank you again. > I managed to fix the issue with .env file where I stated bin folder > where genererateDS is installed. > That, solved the issue without using sys.path. > > And last one from me - in case I have some other issues with > generateDS - where should I report it? > Previously I did it through Bitbucket, how should I do it now? > > Thanks a lot and regards > > Vladan > > __________________________________ > Sent from eM Client | www.emclient.com <http://www.emclient.com/get> > > ------ Original Message ------ > From: "Dave Kuhlman" <dku...@da...> > To: "Vladan Cvejic" <vla...@gm...> > Sent: 13/10/2021 00:10:31 > Subject: Re: Re[2]: generateDS question > >> Vladan, >> >> Glad you found a solution. >> >> By the way, remember that there is also `PYTHONPATH`. >> You can learn about it by doing `$ python --help1`, which >> will tell you: >> >> PYTHONPATH : ':'-separated list of directories prefixed to the >> default module search path. The result is sys.path. >> >> If you are on MS Windows, it will say "';"-separated", I believe. >> >> With respect to your questions about where the generateds `.py` >> files are installed -- I do not use `pipenv` and I do not understand >> it very much. >> I typically use `virtualenv` and `virtualenvwrapper` >> and `pip`. >> When I use those tools, `generateDS.py`, `process_includes.py`, etc. >> get installed in the `bin` directory of my active `virtualenv` >> environment. >> >> The `pipenv` documentation leaves me a bit mystified about where >> `pipenv install` installs files. >> I'm guessing that it installs them in the same locations that `pip` >> would. >> >> If that location is not in `sys.path`, then you will have to >> explicitly add it using the `PYTHONPATH` environment variable or >> `sys.path.append(...) or some other method. >> >> If there is something I can do about this to make the use of >> `pipenv` more convenient, please tell me about it. >> >> Dave >> >> >> >> On Sun 10 Oct 2021 02:24:49 PM PDT, Vladan Cvejic wrote: >> >>> Hello again, >>> >>> thank you for helping. >>> I manage to do it with "not recommended" solution:) >>> by adding a sys.path entry that is showing to bin directory >>> created by pipenv (where is generateDS). >>> >>> I have another question here: >>> - While comparing with other packages I installed in my virtual >>> environment (like flake8, pylint etc) - they all have py files in >>> another directory site-packages (/lib/python3.8/site-packages/) >>> but generateDS.py is not there (there is no /generateDS directory >>> there while for example flake8 is there with py files) >>> And pipenv is only adding the other one >>> (~/,virtualenvs/packages-o_VHYWw_/lib/python3.8/site-packages/) to >>> sys.path. >>> Do you think it is something to do with pipenv and how generateDS >>> is instructing it where should be all files copied etc? >>> >>> That is why, when I added bin path to sys.path it managed to find it. >>> >>> Once more, thank you very much for your help and suggestions (I >>> will know what to study more :) >>> >>> All the best >>> >>> Vladan >>> >>> >>> __________________________________ >>> Sent from eM Client | www.emclient.com <http://www.emclient.com/get> >>> >>> ------ Original Message ------ >>> From: "Dave Kuhlman" <dku...@da...> >>> To: "Vladan Cvejic" <vla...@gm...> >>> Sent: 09/10/2021 00:40:19 >>> Subject: Re: generateDS question >>> >>>> Vladan, >>>> >>>> Good to hear from you. >>>> >>>> It's because `generateDS.py` is not in a location from which it can >>>> be imported, or because it is in a location from which it cannot be >>>> imported. >>>> >>>> Here are a few ideas that might help. >>>> >>>> There are several things you can try: >>>> >>>> - Since you are using `pipenv`, check to make sure that the Python >>>> environment in which you installed `generateds` has been >>>> activated. >>>> >>>> - Find out where the Python executable is located. That will tell >>>> you which installation is active. Looks like you are on Linux, so >>>> you find out by doing this: >>>> >>>> $ which python >>>> >>>> - Find out where `generateDS.py` has been installed and make sure >>>> that directory is in `sys.path`. You can learn where those >>>> locations are at the Python interactive prompt by typing: >>>> >>>> >>> import sys >>>> >>> sys.path >>>> ['', '/usr/lib/python39.zip', '/usr/lib/python3.9', ... ] >>>> >>> >>>> >>>> The '' means current working directory, I believe. >>>> >>>> - Copy `generateDS.py` to a location from which it can be imported, >>>> or make a symbolic link there.rectory, I believe. >>>> >>>> - Modify `sys.path` in your application. This is not a recommended >>>> solution, however. For example: >>>> >>>> >>> import sys >>>> >>> sys.path.append("/path/to/generateds/directory") >>>> >>>> Hope this helps. Let me know if I can answer any questions. >>>> >>>> Dave >>>> >>>> >>>> >>>> On Thu 07 Oct 2021 01:14:27 PM PDT, Vladan Cvejic wrote: >>>> >>>>> Hello Dave, >>>>> >>>>> I apologize for being direct, but I'm in need of your help. >>>>> I am trying to setup a project that is using your program >>>>> generateDS.py on linux (ubuntu). >>>>> Simulation of my workflow is (creating folder, installing >>>>> pipenv, going to pipenv shell, installing pipenv install >>>>> generateDS, creating simple main.py with import generatedDS): >>>>> >>>>> user@test:~/gits$ mkdir test >>>>> user@test:~/gits$ cd test/ >>>>> user@test:~/gits/test$ pipenv install >>>>> Creating a virtualenv for this project… >>>>> Using /usr/bin/python3 (3.8.10) to create virtualenv… >>>>> ⠋created virtual environment CPython3.8.10.final.0-64 in 211ms >>>>> creator >>>>> CPython3Posix(dest=/home/user/.local/share/virtualenvs/test-lQXnKvl3, >>>>> clear=False, global=False) >>>>> seeder FromAppData(download=False, pip=latest, >>>>> setuptools=latest, wheel=latest, pkg_resources=latest, >>>>> via=copy, >>>>> app_data_dir=/home/user/.local/share/virtualenv/seed-app-data/v1.0.1.debian.1) >>>>> activators >>>>> BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator >>>>> >>>>> Virtualenv location: /home/user/.local/share/virtualenvs/test-lQXnKvl3 >>>>> Creating a Pipfile for this project… >>>>> Pipfile.lock not found, creating… >>>>> Locking [dev-packages] dependencies… >>>>> Locking [packages] dependencies… >>>>> Updated Pipfile.lock (9e16cc)! >>>>> Installing dependencies >>>>> from Pipfile.lock (9e16cc)… >>>>> 🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00 >>>>> To activate this project's virtualenv, run the following: >>>>> $ pipenv shell >>>>> user@test:~/gits/test$ pipenv shell >>>>> Spawning environment shell (/bin/bash). Use 'exit' to leave. >>>>> . /home/user/.local/share/virtualenvs/test-lQXnKvl3/bin/activate >>>>> user@test:~/gits/test$ . >>>>> /home/user/.local/share/virtualenvs/test-lQXnKvl3/bin/activate >>>>> (test-lQXnKvl3) user@test:~/gits/test$ pipenv install generateDS >>>>> Installing generateDS… >>>>> Looking in indexes: https://pypi.python.org/simple >>>>> Collecting generateDS >>>>> Using cached generateDS-2.40.3-py3-none-any.whl (141 kB) >>>>> Collecting requests>=2.21.0 >>>>> Using cached requests-2.26.0-py2.py3-none-any.whl (62 kB) >>>>> Collecting lxml >>>>> Using cached lxml-4.6.3-cp38-cp38-manylinux2014_x86_64.whl (6.8 MB) >>>>> Collecting six >>>>> Using cached six-1.16.0-py2.py3-none-any.whl (11 kB) >>>>> Collecting idna<4,>=2.5; python_version >= "3" >>>>> Using cached idna-3.2-py3-none-any.whl (59 kB) >>>>> Collecting certifi>=2017.4.17 >>>>> Using cached certifi-2021.5.30-py2.py3-none-any.whl (145 kB) >>>>> Collecting urllib3<1.27,>=1.21.1 >>>>> Using cached urllib3-1.26.7-py2.py3-none-any.whl (138 kB) >>>>> Collecting charset-normalizer~=2.0.0; python_version >= "3" >>>>> Using cached charset_normalizer-2.0.6-py3-none-any.whl (37 kB) >>>>> Installing collected packages: idna, certifi, urllib3, >>>>> charset-normalizer, requests, lxml, six, generateDS >>>>> Successfully installed certifi-2021.5.30 >>>>> charset-normalizer-2.0.6 generateDS-2.40.3 idna-3.2 lxml-4.6.3 >>>>> requests-2.26.0 six-1.16.0 urllib3-1.26.7 >>>>> >>>>> Adding generateDS to Pipfile's [packages]… >>>>> Pipfile.lock (9e16cc) out of date, updating to (30a375)… >>>>> Locking [dev-packages] dependencies… >>>>> Locking [packages] dependencies… >>>>> Updated Pipfile.lock (30a375)! >>>>> Installing dependencies from Pipfile.lock (30a375)… >>>>> 🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 8/8 — 00:00:11 >>>>> >>>>> >>>>> Then creating simple file: >>>>> (test-lQXnKvl3) user@test:~/gits/test$vim main.py >>>>> >>>>> With following content: >>>>> import generateDS >>>>> print("test") >>>>> generateDS.main() >>>>> >>>>> When trying to run main.py I am getting error - No module named >>>>> 'generateDS': >>>>> (test-lQXnKvl3) user@test:~/gits/test$ python main.py >>>>> Traceback (most recent call last): >>>>> File "main.py", line 1, in <module> >>>>> import generateDS >>>>> ModuleNotFoundError: No module named 'generateDS' >>>>> >>>>> On the other hand when trying following command, I am getting >>>>> response from generateDS, so if I understand correctly it is >>>>> working: >>>>> (test-lQXnKvl3) user@test:~/gits/test$ pipenv run generateDS .py >>>>> >>>>> Synopsis: >>>>> Generate Python classes from XML schema definition. >>>>> Input is read from in_xsd_file or, if "-" (dash) arg, from stdin. >>>>> Output is written to files named in "-o" and "-s" options. >>>>> Usage: >>>>> python generateDS.py [ options ] <xsd_file> >>>>> python generateDS.py [ options ] - >>>>> Options: >>>>> -h, --help Display this help information. >>>>> >>>>> To summarize, I am trying to use generateDS in my project as a >>>>> module (I remember that I did it on Windows, but somehow it is >>>>> not working in Linux). >>>>> Do you have any suggestion? >>>>> >>>>> Kind regards >>>>> >>>>> Vladan >>>>> >>>>> >>>>> __________________________________ >>>>> Sent from eM Client | www.emclient.com <http://www.emclient.com/get> >>>> >>>> >>>> >>>> -- Dave Kuhlman >>>> http://www.davekuhlman.org >>>> >> >> >> >> -- Dave Kuhlman >> http://www.davekuhlman.org >> -- Dave Kuhlman http://www.davekuhlman.org |