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

Adding Python 3 compatibility #35

Closed
mlouielu opened this issue Sep 24, 2019 · 3 comments · Fixed by #47
Closed

Adding Python 3 compatibility #35

mlouielu opened this issue Sep 24, 2019 · 3 comments · Fixed by #47
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@mlouielu
Copy link

Is your feature request related to a problem? Please describe.
In Python 3 default environment, using cFS-GroundSystem is a little tricky, since GroundSystem.py will use /usr/bin/env python for the Subsystem.

And the PyQt4 needs compile & build, it is hard to deploy in the virtual environment for it.

Describe the solution you'd like
Adding Python 3 compatibility for cFS-GroundSystem code.

Describe alternatives you've considered
By using 2to3, we can convert most of the code.

Only 2 parts need to concern:

  • csv reader open file
    • Adding a middle layer of open, or detect version in each files
  • zmq.socket.setsockopt
    • Does the subscription name need to support utf-8?

Additional context
No

Requester Info
Louie Lu / Advanced Rocket Research Center, NCTU, Taiwan

@mlouielu
Copy link
Author

Or, does NASA accept/migrate to Python 3 only code? I'm not sure if this is acceptable or not.

@skliper skliper added the enhancement New feature or request label Nov 19, 2019
@skliper
Copy link
Contributor

skliper commented Dec 6, 2019

Good issue, we do plan to update but as of today I can't except external contributions yet (still trying to get the process in place). Hopefully soon!

@dmknutsen

dmknutsen added a commit to dmknutsen/cFS-GroundSystem that referenced this issue Dec 9, 2019
Updated GroundSystem.py and RoutingService.py scripts needed to upgrade to Python 3.
@skliper skliper added this to the 2.2.0 milestone Dec 12, 2019
@skliper skliper closed this as completed in de8c151 Jan 9, 2020
@mlouielu
Copy link
Author

mlouielu commented Jan 9, 2020

Reading csv file should use open(filename, 'r', newline='') in Python 3.

Otherwise it will raise up:

>>> with open('cs-hk-tlm.txt', 'rb') as f:
...  reader = csv.reader(f)
...  for r in reader:
...   print(r)
... 
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
_csv.Error: iterator should return strings, not bytes (did you open the file in text mode?)

This didn't address in de8c151.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants