Comments (10)
Using str
will fail badly if you have any non-ascii characters in your string, so this approach is not ideal. It is probably better to check of unicode instances and encode them using utf-8. I'll see if I can add some tests to show this problem and fix it properly.
from pyrad.
Thanks! Regarding the difference between running via command-line vs. apache, I assume since my declared console encoding is UTF-8 the command-line script is using that by default. Is there a way to influence the default encoding for the script being run via apache? Would something like pep-0263 work I wonder?
#!/usr/bin/python
# -*- coding: utf-8 -*-
I'll give it a shot and see if it works differently for me.
from pyrad.
More likely web.py is doing decoding for you
from pyrad.
I think I have this mostly fixed in the current git tree. The current tree is also almost fully python 3 compatible, which was a nice side benefit of cleaning this up.
from pyrad.
Thanks! I'll test the change today and let you know if I'm still seeing it.
from pyrad.
Did the changes work for you?
from pyrad.
Sorry its taking so long to verify your change. I'm developing and deploying my code on a Debian stable box running python 2.6.6. I don't have a system level package for the python "six" package, so I'm having to put one together now just to run your code. I also had to mod the test*, server and curved scripts to adjust the "exception x as e" syntax to work on my box without errors when installing. I'll let you know as soon as I have something that works.
from pyrad.
Okay, everything appears to work for me. The only oddity I''ve seen is that the radius secret has to be a binary string. It blows up when I feed it a regular unicode string (as I did before), I now have to explicitly encode it to utf-8 to get it to work. If that is what you intended, then its fine by me. Thanks again for this package!
from pyrad.
the "exception x as e" syntax is supported in Python 2.6, so I don't understand why you had to modify that. I have setup Jenkins to test pyrad with Python 2.6, 2.7 and 3.2 and the tests are passing on all three: http://jenkins.simplon.biz/job/pyrad/
The choice to use a binary string for the secret is deliberate: the secret is an 'octet string' in RFC terms, and does not need to be a human readable text.
from pyrad.
I found my error. It looks like Debian Squeeze has both python 2.5 and 2.6 available by default. The python modules are installed for both interpreters during package installation and the errors are coming from python 2.5. I'll dink around with my packaging so it only gets installed for python 2.6. Thanks again!
from pyrad.
Related Issues (20)
- unhandled exception in client.py _SendPacket()
- Unable to import FreeRADIUS dictionaries HOT 1
- Better documentation and example
- Server.py did not read file changes
- IndexError: list index out of range
- Example acct.py issues PacketError: Packet verification failed with server_async.py HOT 1
- logger error in client_async.py : TypeError: not enough arguments for format string in line 136
- New version release HOT 1
- New version release HOT 1
- Question on if the pyrad based server can do TLS handshaking over RADIUS messages
- netaddr 0.9.0 dependency issue HOT 1
- RFE: please provide support for `netaddr` > 0.8
- how to include 'Class' in Accounting Request?
- Question about PAP in Radius HOT 1
- No listen sockets when /etc/services is not found on debian
- New Version of Pyrad HOT 2
- TypeError: unsupported operand type(s) for ^: 'int' and 'str' in packet.py
- Using pyrad => module 'select' has no attribute 'poll' in client.py ( On Windows, only sockets are supported; on Unix, all file descriptors.)
- Decryption of salt encrypted attributes (encrypt=2) is incorrect
- pyrad access accept packet error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyrad.