Exit with code 1 due to network error protocolunknownerror

#flask #pdf-generation #aws-api-gateway #python-3.7

#flask #pdf-generation #aws-api-gateway #python-3.7

Вопрос:

 from flask import Flask, render_template, make_response import pdfkit   app = Flask(__name__)     @app.route('/lt;Customer_Full_Namegt;/lt;Customer_adressgt;/lt;customerID_numbergt;/lt;CurrentDategt;/lt;Digital_Signaturegt;')  def pdf_template(Customer_Full_Name, Customer_adress, customerID_number,CurrentDate,Digital_Signature):  rendered = render_template('pdf_template.html', Customer_Full_Name=Customer_Full_Name,Customer_adress=Customer_adress,customerID_number=customerID_number, CurrentDate=CurrentDate, Digital_Signature=Digital_Signature)  pdf = pdfkit.from_string(rendered)  response = make_response(pdf, False)  response.headers['Content-Type'] = 'application/pdf'  response.headers['Content-Disposition'] = 'inline;filename=output'   return response  # return render_template('pdf_template.html')      if __name__ == '__main__':  app.run(debug=True)  

127.0.0.1 — — [11/Ноябрь/2021 16:56:58] «ПОЛУЧИТЬ /Customer_Fl_Name/Customedress/customD_number/CurntDate/Dil_Signature HTTP/1.1» 500 —

flask run выход:

 * Serving Flask app 'app.py' (lazy loading)  * Environment: production  WARNING: This is a development server. Do not use it in a production deployment.  Use a production WSGI server instead.  * Debug mode: off  * Running on http://127.0.0.1:5000/ (Press CTRL C to quit) [2021-11-11 16:58:20,679] ERROR in app: Exception on /Customer_Fl_Name/Customedress/customD_number/CurntDate/Dil_Signature [GET] Traceback (most recent call last):  File "/Users/swapnil/Desktop/Clinsj_Certificate/venv/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app  response = self.full_dispatch_request()  File "/Users/swapnil/Desktop/Clinsj_Certificate/venv/lib/python3.7/site-packages/flask/app.py", line 1518, in full_dispatch_request  rv = self.handle_user_exception(e)  File "/Users/swapnil/Desktop/Clinsj_Certificate/venv/lib/python3.7/site-packages/flask/app.py", line 1516, in full_dispatch_request  rv = self.dispatch_request()  File "/Users/swapnil/Desktop/Clinsj_Certificate/venv/lib/python3.7/site-packages/flask/app.py", line 1502, in dispatch_request  return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)  File "/Users/swapnil/Desktop/Clinsj_Certificate/app.py", line 11, in pdf_template  pdf = pdfkit.from_string(rendered, False)  File "/Users/swapnil/Desktop/Clinsj_Certificate/venv/lib/python3.7/site-packages/pdfkit/api.py", line 72, in from_string  return r.to_pdf(output_path)  File "/Users/swapnil/Desktop/Clinsj_Certificate/venv/lib/python3.7/site-packages/pdfkit/pdfkit.py", line 156, in to_pdf  raise IOError('wkhtmltopdf reported an error:n'   stderr) OSError: wkhtmltopdf reported an error: Loading pages (1/6) Warning: Blocked access to file  Warning: Blocked access to file  Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown Counting pages (2/6)  Resolving links (4/6)  Loading headers and footers (5/6)  Printing pages (6/6) Done  Exit with code 1 due to network error: ProtocolUnknownError  

Ответ №1:

Вы должны попытаться добавить эту опцию:

 "enable-local-file-access": ""  

чтобы ваши варианты диктовали

Стефан

Комментарии:

1. Да понял! Спасибо

Содержание

  1. ContentOperationNotPermittedError #1937
  2. Comments
  3. Footer
  4. Network error while generating pdf in windows #2448
  5. Comments
  6. Footer
  7. Exit with code 1 due to network error: ProtocolUnknownError #4400
  8. Comments
  9. Error Exit with code 1 due to network error: ContentOperationNotPermittedError about laravel-snappy HOT 1 CLOSED
  10. Comments (1)
  11. Related Issues (20)
  12. Recommend Projects
  13. React
  14. Vue.js
  15. Typescript
  16. TensorFlow
  17. Django
  18. Laravel
  19. Recommend Topics
  20. javascript
  21. server
  22. Machine learning
  23. Visualization
  24. Recommend Org
  25. Facebook
  26. Microsoft
  27. Exit with code 1 due to network error: UnknownContentError while converting html to pdf #2187
  28. Comments

ContentOperationNotPermittedError #1937

When running wkhtmltopdf 0.12.1 (with patched qt) like this

on a document containing

(a non-existent image), one gets the following output

and a status code of 0 (success), a PDF is generated.

If, however the URL of the image gets slightly changed to something like

(only added a random query param) one gets the following output

and a status code of 1 (error). A PDF is generated nonetheless, but wrapper code will assume a non-recoverable error.

This is clearly very confusing behaviour and imho. a bug.

The text was updated successfully, but these errors were encountered:

I was too getting same error. On further investigation I came to conclusion that inclusion of base tag in head section was cause of problem. I was writing a code like this:

which was causing Exit with code 1 due to network error: ContentOperationNotPermittedError but after removing it the error was removed. Any reasons for this?

@momolog: the reason is simple, in the latter case one cannot guess that this is a request for an image just looking at the URL and hence we consider that it is a more severe error. This is a duplicate of #1855.

@ashkulz Thanks for pointing out, that this is a duplicate.
I fail to see however, why a query parameter would change the expectation of what type of resource
http://example.com/test.jpg?332534
will yield.

See this comment for an explanation.

Hello guys, any progress there by any chance? This is still troublesome.

@KlimczakM: see the linked issue, it requires changes in Qt/WebKit.

I had similar problem: generating PDF from within PHP was working fine, but a direct execution of wkhtmltopdf command in a console was throwing ContentOperationNotPermittedError .

The thing is — I was using url with user token, that later was used inside the code to authenticate on the server:
https://example.com/pdf/$2y$08$FyRmY8aR88AgjRY0DFbFCv===DD0W8L6D.

And I found out that on some OS that address was not interpreted right and the token was malformed by the time in got to my js-script.

So, changing $ to %24 and = to %3D did the trick.

Maybe it will help someone.

I also got this error today. In my case it was because I’d made a change to my nginx config that blocked access to the website in question for the server that wxhtmltopdf was running on. Basically, wkhtmltopdf got a «401 Forbidden» when trying to open the URL, and that resulted in this error.

© 2023 GitHub, Inc.

You can’t perform that action at this time.

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.

Источник

Network error while generating pdf in windows #2448

Hi I am currently using snappy to generate pdf. But I am currently facing a problem while generating pdf in windows. The pdf is generated as expected but a run time exception is always thrown. The exception is as follows:

RuntimeException: The exit status code ‘1’ says something went wrong: stderr: «Loading pages (1/6) [> ] 0% [======> ] 10% [===========> ] 19% [============> ] 20% [================> ] 27% [==================> ] 30% [============================================================] 100% Counting pages (2/6) [============================================================] Object 1 of 1 Resolving links (4/6) [============================================================] Object 1 of 1 Loading headers and footers (5/6) Printing pages (6/6) [> ] Preparing [============================================================] Page 1 of 1 Done Exit with code 1 due to network error: ContentOperationNotPermittedError » stdout: «» command: C://xampp/htdocs/modules/pdf/wkhtmltopdf/bin/wkhtmltopdf.exe —lowquality «C:UserssonyAppDataLocalTempknp_snappy5590f02e7424a4.53154017.html» «queue.pdf». in KnpSnappyAbstractGenerator->checkProcessStatus()

Can you help me to get rid of this problem? Thanks.

The text was updated successfully, but these errors were encountered:

On further investigation I came to conclusion that inclusion of base tag in head section was cause of problem. I was writing a code like this:

which was causing Exit with code 1 due to network error: ContentOperationNotPermittedError but after removing it the error was removed. Any reasons for this?

In a new version (0.12.5) you should get more information on these kinds of error.

© 2023 GitHub, Inc.

You can’t perform that action at this time.

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.

Источник

Exit with code 1 due to network error: ProtocolUnknownError #4400

OS information
Ubuntu
18.04.1 LTS (Bionic Beaver)

Exit with code 1 due to network error: ProtocolUnknownError

The text was updated successfully, but these errors were encountered:

That’s not telling us very much information. What site are you trying to convert to PDF? What is the command line that gives this error? Is there anything else we need to know about this failure? I’m not sure what «Protocol Unknown Error» is reporting, but at least someone could try it out.

Actually I am working with odoo.com and in this they have used it as a package to convert HTML reports to pdf where I have found this issue. I am attaching a screen shot for better understanding where I also selected the issue.

It looks like you’re trying to pull something off the Web, and presumably convert it to PDF via Odoo, but I have no experience with Odoo. Does this work with other websites and only fail with this one, or does it always fail? The only thing I can think of at this point is to check if they’re using an old version of wkHTMLtoPDF, or if they’re up to date (at least version 0.12.5). Even then, if the website uses too advanced of CSS or Javascript, wkHTMLtoPDF would fail.

Actually right now we are only working with Odoo and I have tweak the wkhtmltopdf arguments in a bit of an absurd way and restructure my report template so it worked but yes you are right It almost uses advance JS and CSS therefore sometimes it fails but most of the time it succeeded so I am closing this issue as it is resolved hope so in next update more things will be sorted out.

Actually right now we are only working with Odoo and I have tweak the wkhtmltopdf arguments in a bit of an absurd way and restructure my report template so it worked but yes you are right It almost uses advance JS and CSS therefore sometimes it fails but most of the time it succeeded so I am closing this issue as it is resolved hope so in next update more things will be sorted out.

Can you share whichi options? thanks

✅ SOLUTION:
This is for those with the error: Exit with code 1 due to network error: ProtocolUnknownError
If you get an error when uploading an image/media, you have to upload that image to your own http server or hosting, for example in XAMPP. Put the complete link of the image in the html, example: img src=’https: // 127.0.0.1/web/chart.jpg’> In this way the images will be loaded well at the time of passing them to pdf. When creating the pdf, you can already delete the image from the hosting or remove the server.

Actually right now we are only working with Odoo and I have tweak the wkhtmltopdf arguments in a bit of an absurd way and restructure my report template so it worked but yes you are right It almost uses advance JS and CSS therefore sometimes it fails but most of the time it succeeded so I am closing this issue as it is resolved hope so in next update more things will be sorted out.

have you find some solution?
I Have the same error on odoo 14.0 on premise and I obtain:

Источник

Error Exit with code 1 due to network error: ContentOperationNotPermittedError about laravel-snappy HOT 1 CLOSED

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/KnpLabs/snappy instead. When having doubts, please try to reproduce the issue with just snappy.
If you believe this is an actual issue with the latest version of laravel-snappy, please reply to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.

  • Setting config value «timeout» to false causes the process timeout default value 60 secs HOT 1
  • Title not centering HOT 1
  • Method ‘stream’ is deprecated by the PdfWrapper HOT 1
  • How to protect my Generated PDF file from editing HOT 1
  • Call the function to remove temporary files HOT 6
  • Docker + error the exit status code ‘127’ HOT 2
  • The option ‘0’ doesn’t exist. HOT 2
  • Image not showing problem HOT 1
  • [ISSUE] Content not fit A4 page HOT 1
  • The exit status code ‘136’ says something went wrong: HOT 1
  • The process has been signaled with signal «9» HOT 1
  • The exit status code ‘137’ says something went wrong HOT 1
  • Unknown long argument —lowquality HOT 1
  • Any work around with Jspreadsheet V4 pdf export ? HOT 1
  • Can’t load header and footer HOT 2
  • The process has been signaled with signal «11» HOT 1
  • Imported Google fonts printing twice with slight offset HOT 1
  • Colours fine on initial load of PDF, then on zoom they appear to change to CMYK and go dull HOT 1
  • Javascript security HOT 1
  • Unable to Generate PDF on M1 Mac HOT 2

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

Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

javascript

JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

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

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.

Источник

Exit with code 1 due to network error: UnknownContentError while converting html to pdf #2187

There is html file:

There is an error:

Most of the time its working well. But for some generated google urls like this one it throws such an error.

Thanks a lot.

The text was updated successfully, but these errors were encountered:

Bumping having this same issue

QNetworkReply::UnknownContentError: 299: an unknown error related to the remote content was detected

In #1948 we can read:

It looks like you are trying to load a dynamic resource which is not found (see explanation) — you might want to see what it is.

However it doesn’t solve the problem, because there is no way to ignore such error and continue. Currently it prevents generation of the output file.

Same problem here =(

I hit UnknownContentError as well. It seems like when I reach the 16-18 page mark, with header+footer, it causes the error.

I moved my problem into a new issue: #2778

I hit this error for a single page without any header or footer and without javascript running.

To debug this problem try running the conversion with —no-images which runs fine. I then saved the file locally to find out which image was offending. To test with a local copy do not forget to set e.g. in the section of the html appropriately.

If the document is large, use grep -A2 » to find urls to check. Use wget on these urls and inspect their content. This yields an img resource on archive.org, with an html response body, an image url which was broken at archival time.

  • archive.org replays http status codes for archived resources, in this case it is/was 400: Bad Request
  • QT webkit transforms this into UnknownContentError , presumably trying to interpret the html response body (the error message) as an image, despite code 400

After a review I can «ignore» this problem, since the pdf in question renders fine without the img resource. However I do not want to ignore non-zero return status in a batch invocation of wkhtmltopdf (to find and break on more serious errors).

The specific problem described above can be coupled to the load-media-error class.

  • wkhtmltopdf defaults to —load-media-error-handling ignore
  • the ‘ignore’ handlers do not trigger non-zero exit codes
  • UnknownContentError triggered from loading sources (or, more generally any page requisite with an image/* mime type) should be handled like any other load-media-error

(using statically compiled wkhtmltopdf 0.12.3-dev (with patched qt) )

Источник

excel_zm Asks: How to add GeoJSON file to Leftlet map
I am new to JavaScript, HTML, and Leaflet. I would like to add a polygon to my Leaflet map.

I created a geojson file of two polygons (Will County, IL and Cook County, IL). I know the syntax is correct because I created it in FME and I can view it in FME and QGIS with the LL84 coordinate system. How do I add the geojson file to my html page?

Here is where I store the file. I want to use this file and don’t want to add thousands of coordinates to my html. This file is stored locally and I do not know if that is an issue. T:EYFP.geojson

Here is my HTML page. «»

// Initialize the map and set its view to Chicago var map = L.map(‘map’).setView([41.881832, -87.623177], 11);
var streetLayer = L.tileLayer(‘https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png’, { attribution: ‘© OpenStreetMap contributors’ });

streetLayer.addTo(map);

«»
Here is what the geojson file looks like. It has thousands of coordinates, but I’ve removed them (using BoundingBoxReplacer in FME) so I can paste them here. «»{ «type» : «FeatureCollection», «name» : «FP», «features» : [ { «type» : «Feature», «geometry» : { «type» : «Polygon», «coordinates» : [ [ [ -88.2635070004, 41.4695240004 ], [ -87.1111620005, 41.4695240004 ], [ -87.1111620005, 42.1542919999 ], [ -88.2635070004, 42.1542919999 ], [ -88.2635070004, 41.4695240004 ] ] ] }, «properties» : { «COUNTY» : «Cook County, IL», «OBJECTID» : 1 } }, { «type» : «Feature», «geometry» : { «type» : «Polygon», «coordinates» : [ [ [ -88.2614680002, 41.2015459998 ], [ -87.5255909999, 41.2015459998 ], [ -87.5255909999, 41.72893 ], [ -88.2614680002, 41.72893 ], [ -88.2614680002, 41.2015459998 ] ] ] }, «properties» : { «COUNTY» : «Will County, IL», «OBJECTID» : 2 } } ] }»»

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, solveforum.

Помощь

Odoo is the world’s easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project management
  • MRP

Take the tour

  • All Forums

  • Topics
  • Люди
  • Теги
  • Значки
  • О программе

Avatar

Hi All , 

We are facing the following error when exporting barcode product report for large number of products  from odoo.com 

Wkhtmltopdf Exit with code 1 due to network error: ProtocolUnknownError

Can anyone help in this ? 

Avatar

Hi,

report.url Key is set in your Settings?

Go to Settings —> Technical —> SystemParameter 

if it does not exist then create a new record in System Parameter

Key: report.url
Value: http://127.0.0.1:8069

Note: Modify 8069 with your ODOO Running Port.

Thanks & Regards
Sunny Sheth

Avatar

please install compatible version of Wkhtmltopdf

Avatar

Hello. Did you find a solution to this issue ? I am also using Odoo.sh.

Avatar

i already added this parameter and i am using odoo.sh 

i added the URL of odoo sh but issue is still exist

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Execution error return code 1 from org apache hadoop hive ql exec tez teztask
  • Exec format error selenium
  • Exec format error insmod
  • Exec error 22 attempting to run matlab
  • Exchange remote error from proxy target socketerror

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии