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
write text files in pythran fails #1699
Comments
Pythran indeed supports the |
Ok, two problems spotted. First pythran doesn't support bound methods as it should. Second pythran's #pythran export write_test(str,bool)
#pythran export fake_write(str)
def write_test(fname,r):
if r:
print('writing %s'%fname)
f = open(fname,'w')
#write_line = f.writelines
write_line = lambda s: f.write(s)
else:
print('NO FILE WILL BE WRITTEN')
write_line = fake_write
for i in range(10):
write_line(str(i) + '\n')
if r:
f.close()
def fake_write(s):
return None |
Using existing support for partial functions. Fix #1699
@mgirardis can you confirm #1701 fixes your issue? |
@serge-sans-paille I'm not the most savvy with github, here is what I've done: Yesterday, after posting the issue, I uninstalled the pythran 0.9.8.post2 and cloned this repository to try and see if the issue was still there in the 0.9.9.dev... And the error persisted... so now after you posted this fix, I did the following
in the pythran clone directory I have in my local machine then, I installed pythran (I did NOT uninstall the previous pythran 0.9.9.dev)
and I still have the same error with the code I posted... The code you suggested works fine, though (returning None with the lambda function). Maybe I need to do something different from what I said here to fix the issue in my local copy? |
Almost there! The PR was based on branch |
Great! It worked now :) thanks! and keep up the good work! |
Using existing support for partial functions. Fix #1699
In its manual page, pythran says it supports the method
write
fromTextIOWrapper
However, trying to compile this simple file
file:
mylib.py
with the command line
fails with the message:
Pythran version:
0.9.8.post2
Python version:
3.8.5
Using Ubuntu 20.04.1 LTS
The text was updated successfully, but these errors were encountered: