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

Unable to convert collection using postman2robotframework #1

Open
aryalakshmi opened this issue Feb 4, 2024 · 3 comments
Open

Unable to convert collection using postman2robotframework #1

aryalakshmi opened this issue Feb 4, 2024 · 3 comments

Comments

@aryalakshmi
Copy link

Hi,

I am trying to use given library to convert a postman collection to robotframework but unable to do so because of below error:

C:\Users\aryalakr\Documents\postman\postman_js>postman2robot --ifile Web_CGI_Automation.postman_collection.json --ofile putput

####################################
#                                  #
#     POSTMAN TO ROBOTFRAMEWOK     #
#                                  #
####################################

←[47m←[30m INFO ←[0m Use ←[32m postman2robot -h ←[0m to learn how to use the command line
←[47m←[30m INFO ←[0m You can use a ←[32m.postman2robotrc file ←[0m to avoide typing options everytime
Traceback (most recent call last):
File "C:\Python3\lib\site-packages\jinja2\loaders.py", line 357, in get_source
source = self._loader.get_data(p) # type: ignore
OSError: [Errno 0] Error: 'src\assets\library_template.py'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Python3\Scripts\postman2robot-script.py", line 11, in
load_entry_point('postman2robot==0.0.1', 'console_scripts', 'postman2robot')()
File "C:\Python3\lib\site-packages\postman2robot-0.0.1-py3.7.egg\cli\postman2robot.py", line 58, in main
File "C:\Python3\lib\site-packages\postman2robot-0.0.1-py3.7.egg\cli\postman2robot.py", line 78, in run
File "C:\Python3\lib\site-packages\jinja2\environment.py", line 1010, in get_template
return self._load_template(name, globals)
File "C:\Python3\lib\site-packages\jinja2\environment.py", line 969, in _load_template
template = self.loader.load(self, name, self.make_globals(globals))
File "C:\Python3\lib\site-packages\jinja2\loaders.py", line 125, in load
source, filename, uptodate = self.get_source(environment, name)
File "C:\Python3\lib\site-packages\jinja2\loaders.py", line 359, in get_source
raise TemplateNotFound(template) from e
jinja2.exceptions.TemplateNotFound: library_template.py

C:\Users\aryalakr\Documents\postman\postman_js>

Library version:
postman2robot==0.0.1
Python: 3.7.5

Can you please help me to overcome this issue?

Thanks,
Aryalakshmi R

@xNok
Copy link
Owner

xNok commented Feb 4, 2024

The CLI uses Jinja templates and requires one template to be available in the expected path.

OSError: [Errno 0] Error: 'src\assets\library_template.py'

You can copy over the default template in this folder src\assets\library_template.py.

I have to admit this is not ideal. The default template in this repo should be used if no template does not exist. If you find this cli useful and want to contribute, please submit a PR 😄 .

@aryalakshmi
Copy link
Author

Hi,

Since i am new to jinja can you please provide any link to download this kind of template. I tried once basic template which was put in src/assets and renamed as library_template.py but couldnt fix the issue.

@LuisMorais08
Copy link

LuisMorais08 commented Sep 12, 2024

Hey @aryalakshmi ! I've got the same problem as you. I've followed @xNok comment above and it worked!
What you should do is follow the same structure that is present in the repo. This way, you need to add a file named library_template.py, which can be found here, into this a path scheme that follows:

|- src
  |- asserts
     |- library_template.py

The src path can be found in your own error message, which might be C:\Python3\lib\site-packages\postman2robot-0.0.1-py3.7.egg\src. In my case, I needed to create the asserts directory by my own (watch out for typos haha).
After that, you just need to run as indicated in the documentation. I hope it work for you!!

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