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

syntax error #23

Open
surbhiisharma opened this issue Jan 16, 2020 · 9 comments
Open

syntax error #23

surbhiisharma opened this issue Jan 16, 2020 · 9 comments

Comments

@surbhiisharma
Copy link

surbhiisharma commented Jan 16, 2020

Hi there,

I remember using pycorn to extract data from .res files last year and it worked without any issue. I recently tried to use it again (now with .zip files from UNICORN7) but I keep getting this syntax error:

pycorn-bin.py --extract .csv sample1.res
  File "<stdin>", line 1
    pycorn-bin.py --extract .csv sample1.res
                                       ^
SyntaxError: invalid syntax

I tried using the sample file for more clarity.

I was also wondering if the switch from .res to zip files means I need to use the entire .zip folder or just the 'Result.xml' file

@pyahmed
Copy link
Owner

pyahmed commented Jan 16, 2020

pycorn-bin.py --extract .csv sample1.res
Try removing the .

pycorn-bin.py --extract csv sample1.res

For UNICORN7 just use the entire zip, don't extract it.

@surbhiisharma
Copy link
Author

surbhiisharma commented Jan 17, 2020

thank you for such a quick response! I tried what you suggested and I'm still getting a similar error

pycorn-bin.py --extract csv test1.zip
  File "<stdin>", line 1
    pycorn-bin.py --extract csv test1.zip
                              ^
SyntaxError: invalid syntax

@pyahmed
Copy link
Owner

pyahmed commented Jan 17, 2020

I just tried with the sample1.res and it works for me. Can you remove any pycorn installations and reinstall and check if that fixes the problem? Seems as if the pycorn file has been modified.

@surbhiisharma
Copy link
Author

Hi,

I tried removing pycorn and reinstalling but is still doesn't seem to be working. even pycorn.py -h gives the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'pycorn' is not defined

@pyahmed
Copy link
Owner

pyahmed commented Jan 21, 2020

pycorn.py -h wont give you anything as there are no command line options defined in that file.

@surbhiisharma
Copy link
Author

surbhiisharma commented Jan 21, 2020

Hm, makes sense. I was hoping to see if using the -h argument could help me dig deeper and solve my problem. Do you have any other ideas why this might be happening? Sorry, I'm a little confused myself and don't understand why it's not working.

@surbhiisharma
Copy link
Author

I got the sample.res file to work on my windows machine! (I was using a mac earlier and I'm not sure if maybe that was contributing to the issue?)

However, when I try using the zip file instead I get the following error message:

Chromatogram
{'FormatVersion': '9', 'UNICORNVersion': '7.3.0.473'}
added - orig data
added - orig data
Writing: Injection
Traceback (most recent call last):
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\Scripts\pycorn-bin.py", line 390, in <module>
    main2()
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\Scripts\pycorn-bin.py", line 375, in main2
    data_writer1(fname, fdata)
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\Scripts\pycorn-bin.py", line 294, in data_writer1
    type = inp[i]['data_type']
KeyError: 'data_type'

@pyahmed
Copy link
Owner

pyahmed commented Feb 6, 2020

I'm afraid that file is just a bit different to the UNICORN 7 files that I had when I wrote the script.

@fideramirez90
Copy link

Can anyone help with this? It is when trying to open a zip file from Unicorn 7 results.

Thanks!

pycorn-bin.py --extract csv 1.zip
Traceback (most recent call last):
  File "C:\Users\AppData\Local\Programs\Python\Python310\Scripts\pycorn-bin.py", line 390, in <module>
    main2()
  File "C:\Users\AppData\Local\Programs\Python\Python310\Scripts\pycorn-bin.py", line 368, in main2
    fdata.load()
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\pycorn\pycorn.py", line 307, in load
    zip_data = self.zip2dict(input_zip)
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\pycorn\pycorn.py", line 368, in zip2dict
    tmp_dict = {i:inp.read(i)}
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\zipfile.py", line 1476, in read
    return fp.read()
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\zipfile.py", line 911, in read
    buf += self._read1(self.MAX_N)
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\zipfile.py", line 1001, in _read1
    data = self._decompressor.decompress(data, n)
zlib.error: Error -3 while decompressing data: invalid literal/length code

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