question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

For file format QR code.

See original GitHub issue

I made a simple wrapper to handle the file format QR code:

def _decode(self, filename):
    try:
        # the origin code
        cmd = ' '.join([self.command, self.lib_path, 'file:///' + filename, '--multi'])
        (stdout, _) = subprocess.Popen(cmd,
                                        stdout=subprocess.PIPE,
                                        universal_newlines=True,
                                        shell=True).communicate()
        lines = stdout.splitlines()
        separator_idx = [
            i for i in range(len(lines)) if lines[i][:4] == 'file'
        ] + [len(lines)]

        result = [
            self._parse_single(lines[separator_idx[i]:separator_idx[i + 1]])
            for i in range(len(separator_idx) - 1)
        ]
    except:
        # my add-in code
        cmd = ' '.join([self.command, self.lib_path, 'file:///' + filename, '--multi'])
        (lines, _) = subprocess.Popen(cmd,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE).communicate()
        result = lines[lines.index(b'Raw result:\n')+len(b'Raw result:\n'):lines.index(b'\nFound')]
    return result

This will return the ‘Raw result’ bytes while the result can’t be decoded with the default character set.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ChenjieXucommented, Mar 6, 2021

I change everything into bytes. Please check the latest version.

0reactions
469312306commented, Mar 6, 2021

thank you for update!

Read more comments on GitHub >

github_iconTop Results From Across the Web

QR Code File Formats - QR4 - QRCode
QR codes can be created and saved in various bitmap and vector formats. Which type is best for your QR codes? When is...
Read more >
File QR code converter: Create QR codes for your files
File to QR code: Ultimate guide on how to use a file QR code converter to convert your files into a QR code...
Read more >
QR code - Wikipedia
A QR code is a type of matrix barcode (or two-dimensional barcode) invented in 1994 by the Japanese company Denso Wave. A barcode...
Read more >
print-ready Vector Format | qrd°by - EPS QR Code Generator
QR means "quick response" and QR Codes allow users quick and easy access to web pages, PDF files, videos, forms or other information....
Read more >
What's the best format for QR Code file (SVG, JPG, TIFF, PNG)?
Conclusion: JPEG is not only uglier, but also much larger than the other formats. GIF good, but PNG is the smallest and has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found