-
Notifications
You must be signed in to change notification settings - Fork 89
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
Support for Python 3 #11
Comments
The above mentioned problem has been addressed by replacing controls = [map(eval,a.replace("controls","").split("and")) for a in tokens if a.startswith("controls")] with [eval(a.replace("controls", "").split("and")) for a in tokens if a.startswith("controls")] in The next problem seems to be Below is a standalone example to reproduce the problem: #!/usr/bin/env python
import sys,os,signal,subprocess,threading,tempfile
AsyTempDir=tempfile.mkdtemp(prefix="asy_")+os.sep
print("AsyTempDir: '{}'".format(AsyTempDir))
(rx,wx) = os.pipe()
(ra,wa) = os.pipe()
cmd = ['asy',"-noV","-multiline","-q", "-o"+AsyTempDir,"-inpipe="+str(rx),"-outpipe="+str(wa)]
print(cmd)
# when close_fds=True, it hangs on 2.7 as well
quickAsy=subprocess.Popen(cmd,close_fds=False)
fout=os.fdopen(wx,'w')
fin=os.fdopen(ra,'r')
#######
fout.write("reset;\n")
fout.write("initXasyMode();\n")
fout.write("atexit(null);\n")
fout.write('xformStack.push((0, 0, 1, 0, 0, 1));\n')
fout.write('label(Label("test",(0, 0),rgb(0,0,0)+0.5,align=SE));\n')
fout.write('deconstruct(1.000000);\n')
fout.flush()
text = fin.readline()
print(" readline:")
print("'{}'".format(text))
fout.write("exit;\n");
fin.close()
fout.close() The parameter |
I fixed the problem with pipes thanks to some great answers from MacPorters and will describe more details soon. John, is the second replacement for Old code: oneLiner = "".join(split(join(pathStrLines))) New code: # oneLiner = "".join(" ".join(pathStrLines).split()) # this is literal translation
oneLiner = "".join(pathStrLines).replace(" ", "") # this is probably more straightforward |
It would be nice if
xasy
was properly ported to Python 3.I spent a few hours debugging xasy against Python 3 and here's where I'm stuck:
The function
def updateCode(self,mag=1.0)
fromxasy2asy
callsself.asyCode += self.makeNodeStr(self.controlSet[count][0])
The problem is that
self.controlSet
is a list of map objects and Python 3 is no longer happy about it:My first naive approach was the following:
The problem is that
list(map(...))
somehow deletes the contents of map, so that one can only access those variables once. See also http://www.artima.com/weblogs/viewpost.jsp?thread=98196. Do you know how to convertmap
s into proper array entries?The text was updated successfully, but these errors were encountered: